'use strict';
game.import('character', function (lib, game, ui, get, ai, _status) {
	return {
		name: 'onehun',
		connect: true,
		characterSort: {
			onehun: {
				zhijiang_feng: ['beila', 'xiangwan', 'jiale', 'jiaran', 'nailin', 'acao', 'heicao'],
				zhijiang_hua: ['dingwanren', 'huangjiaqi', 'linnaiqi', 'jiaxintang', 'caoxuezhang', 'beijixing'],
				zhijiang_xue: ['niuzhi', 'yingyingmin', 'zhijiangemeng'],
				zhijiang_yue: [],
				zhijiang_tedian: ['bolilingran', 'mobile_xiangwan', 'sansan'],
			},
		},
		character: {
			//hun
			beila: ['female', 'hun', 4, ['yuyong', 'wuhun', 'yuemian'], ['zhu'], 2, ['Dshuchu', 'Dfangyu']],
			xiangwan: ['female', 'hun', 3, ['puge', 'yaoqiang', 'cainv'], null, 3, ['Dshuchu', 'Dkongchang', 'Dhuifu']],
			jiale: ['female', 'hun', 3, ['daican', 'anchao'], null, 3, ['Dfuzhu']],
			jiaran: ['female', 'hun', 4, ['ranyou', 'huamo', 'shuangmian'], null, 4, ['Dshuchu', 'Dfuzhu']],
			nailin: ['double', 'hun', 3, ['danda', 'qingchun', 'naiao'], null, 4, ['Dshuchu', 'Dhuifu']],
			acao: ['male', 'hun', 4, ['taiji', 'gaozui'], null, 4, ['Dfangyu']],
			heicao: ['male', 'hun', 4, ['neiping'], null, 3, ['Dkongchang']],

			bolilingran: ['female', 'hun', 3, ['jiejie', 'ranyou'], null, 4, ['Dshuchu', 'Dfuzhu', 'Dkongchang']],

			mobile_xiangwan: ['female', 'hun', 3, ['zhaowan', 'maoyu'], null, 2, ['Dshuchu', 'Dkongchang', 'Dhuifu']],

			sansan: ['female', 'hun', 3, ['shensuan', 'guili', 'zhiju'], null, 4, ['Dkongchang']],
			//au
			dingwanren: ['female', 'hun', 3, ['zhuliu', 'xueyan', 'luanbei'], null, 4, ['Dshuchu', 'Dkongchang']],
			huangjiaqi: ['female', 'hun', 4, ['zhengbei', 'lijia'], null, 2, ['Dfuzhu', 'Dkongchang']],
			linnaiqi: ['male', 'hun', 3, ['heimu', 'xiangfu'], null, 3, ['Dfuzhu', 'Dkongchang']],
			jiaxintang: ['male', 'hun', '3/4', ['kangya', 'tianyin', 'fabing'], null, 4, ['Dshuchu', 'Dkongchang', 'Dfangyu']],
			caoxuezhang: ['female', 'hun', 4, ['hongru', 'shuangbiao'], null, 2, ['Dshuchu', 'Dkongchang']],
			beijixing: ['male', 'hun', 3, ['jiheng', 'ziwei'], null, 5, ['Dfangyu', 'Dkongchang']],

			//au2
		//	niuzhi: ['female', 'hun', 5, ['niupi', 'niuduo'], null, 4, ['Dshuchu', 'Dfangyu']],
		//	yingyingmin: ['female', 'hun', 3, ['changsheng', 'choutai'], null, 2, ['Dshuchu', 'Dkongchang']],
		//	zhijiangemeng: ['male', 'hun', 4, ['guishu'], null, 3, ['Dkongchang']],
		},
		characterIntro: {
			beila: '<li>立绘：鹿岛Kashima<br><li>配音：QS Alter',
			xiangwan: '<li>立绘：痴呆症的患者<br><li>配音：敉鸮Owl&nbsp;&nbsp;樱花庄の小光',
			jiale: '<li>立绘：_Kimmm_<br><li>配音：菜豆Kayo&nbsp;&nbsp;樱花庄の小光',
			jiaran: '<li>立绘：塔哒哝二九<br><li>配音：泠月&nbsp;&nbsp;樱花庄の小光',
			nailin: '<li>立绘：change三生烟<br><li>配音：暂无',
			acao: '<li>立绘：A-SOUL官方<br><li>配音：椰子海獭&nbsp;&nbsp;Alter',
			heicao: '<li>立绘：A-SOUL官方<br><li>配音：椰子海獭&nbsp;&nbsp;Alter',
			bolilingran:'<li>立绘：歪瓜是什么<br><li>配音：泠月&nbsp;&nbsp;樱花庄の小光',
			sansan:'<li>立绘：囚书<br><li>配音：菜豆Kayo&nbsp;&nbsp;樱花庄の小光',
			mobile_xiangwan:'<li>立绘：A-SOUL官方<br><li>配音：暂无',
			dingwanren:'<li>立绘：change三生烟<br><li>配音：暂无',
			huangjiaqi:'<li>立绘：change三生烟<br><li>配音：kyokoaki&nbsp;&nbsp;樱花庄の小光',
			linnaiqi:'<li>立绘：change三生烟<br><li>配音：阿殊今天吃什么&nbsp;&nbsp;樱花庄の小光',
			jiaxintang:'<li>立绘：change三生烟<br><li>配音：crice&nbsp;&nbsp;樱花庄の小光',
			caoxuezhang:'<li>立绘：change三生烟<br><li>配音：kyokoaki&nbsp;&nbsp;樱花庄の小光',
			beijixing:'<li>立绘：change三生烟<br><li>配音：不宣&nbsp;&nbsp;樱花庄の小光',
		},
		card: {
			Smingan: {
				audio: "Smingan",
				derivation: 'xiangwan',
				fullskin: true,
				type: 'scaleph',
				enable: true,
				usable: 1,
				range: { attack: 1 },
				filterTarget: function (card, player, target) {
					return target != player;
				},
				selectTarget: 1,
				content: function () {
					'step 0'
					target.chooseToDiscard('弃置所有基本牌，否则受到2点伤害', Math.max(1, target.countCards('h', { type: 'basic' })), function (card) {
						return get.type(card) == 'basic';
					}).set('ai', function (card) {
						var target=_status.event.player;
						if (target.countCards('h', { name: 'tao' }) >= 2 || (target.hasSkillTag('maixie') && target.hp > 2) || target.countCards('h', { name: 'du' }) >= 2) return false;
						return true;
					})
					'step 1'
					if (result.bool == false) {
						target.damage(2, player);
					}
				},
				ai: {
					basic: {
						useful: 2,
						value: [7, 3, 1.3],
					},
					order: 11,
					result: {
						target: -2,
					},
					tag: {
						damage: 2,
						discard: 1,
					}
				}
			},
			Skeai: {
				audio: "Skeai",
				derivation: 'xiangwan',
				fullskin: true,
				type: 'scaleph',
				toself: true,
				enable: function (card, player) {
					return player.hp < player.maxHp;
				},
				savable: true,
				selectTarget: -1,
				filterTarget: function (card, player, target) {
					return target == player && target.hp < target.maxHp;
				},
				modTarget: function (card, player, target) {
					return target.hp < target.maxHp;
				},
				content: function () {
					'step 0'
					target.recover(event.baseDamage || 1, get.nature(event.card));
					'step 1'
					if (target.hp != target.maxHp)
						target.draw();
				},
				ai: {
					basic: {
						order: function (card, player) {
							if (player.hasSkillTag('pretao')) return 5;
							return 2;
						},
						useful: [7, 4.2, 3, 2.3],
						value: [7, 4.2, 3, 2.3],
					},
					canLink: function (player, target, card) {
						if (!target.isLinked() && !player.hasSkill('wutiesuolian_skill')) return false;
						return true;
					},
					result: {
						target: 2,
						target_use: function (player, target) {
							// if(player==target&&player.hp<=0) return 2;
							if (player.hasSkillTag('nokeep', true, null, true)) return 2;
							var nd = player.needsToDiscard();
							var keep = false;
							if (nd <= 0) {
								keep = true;
							}
							else if (nd == 1 && target.hp >= 2 && target.countCards('h', 'tao') <= 1) {
								keep = true;
							}
							var mode = get.mode();
							if (target.hp >= 2 && keep && target.hasFriend()) {
								if (target.hp > 2 || nd == 0) return 0;
								if (target.hp == 2) {
									if (game.hasPlayer(function (current) {
										if (target != current && get.attitude(target, current) >= 3) {
											if (current.hp <= 1) return true;
											if ((mode == 'identity' || mode == 'versus' || mode == 'chess') && current.identity == 'zhu' && current.hp <= 2) return true;
										}
									})) {
										return 0;
									}
								}
							}
							if (target.hp < 0 && target != player && target.identity != 'zhu') return 0;
							var att = get.attitude(player, target);
							if (att < 3 && att >= 0 && player != target) return 0;
							var tri = _status.event.getTrigger();
							if (mode == 'identity' && player.identity == 'fan' && target.identity == 'fan') {
								if (tri && tri.name == 'dying' && tri.source && tri.source.identity == 'fan' && tri.source != target) {
									var num = game.countPlayer(function (current) {
										if (current.identity == 'fan') {
											return current.countCards('h', 'tao');
										}
									});
									if (num > 1 && player == target) return 2;
									return 0;
								}
							}
							if (mode == 'identity' && player.identity == 'zhu' && target.identity == 'nei') {
								if (tri && tri.name == 'dying' && tri.source && tri.source.identity == 'zhong') {
									return 0;
								}
							}
							if (mode == 'stone' && target.isMin() &&
								player != target && tri && tri.name == 'dying' && player.side == target.side &&
								tri.source != target.getEnemy()) {
								return 0;
							}
							return 2;
						},
					},
					tag: {
						recover: 1,
						save: 1,
						draw: 1,
					}
				}
			},
			Shaixiu: {
				audio: "Shaixiu",
				derivation: 'xiangwan',
				fullskin: true,
				type: 'scaleph',
				notarget: true,
				nodelay: true,
				content: function () {
					game.delay(0.5);
				},
				ai: {
					order: 3,
					basic: {
						useful: 11,
						value: [8, 4.5, 3],
					},
					result: { player: 1.5 },
					tag: {
						draw: 1,
					},
					//expose:0.2
				}
			},
			Saojiao: {
				audio: "Saojiao",
				derivation: 'xiangwan',
				fullskin: true,
				type: 'scaleph',
				enable: true,
				range: { range: 1 },
				selectTarget: 1,
				filterTarget: function (card, player, target) {
					return target.countCards('e') || target.countCards('j');
				},
				content: function () {
					'step 0'
					var list = [];
					if (target.countCards('e')) list.push('装备区');
					if (target.countCards('j')) list.push('判定区');
					player.chooseControl(list, function (event, player) {
						var att = get.attitude(player, target);
						if (att >= 0) {
							var cardsj = target.getCards('j');
							var cardse = target.getCards('e');
							var num1 = 0;
							var num2 = 0;
							for (var i = 0; i < cardsj.length; i++) {
								if (get.tag(cardsj[i], 'delay') == 'bad') num1++;
							}
							for (var i = 0; i < cardse.length; i++) {
								if (cardse[i].name == 'yinfengyi' || cardse[i].name == 'yonglv' || cardse[i].name == 'duanjian' || (cardse[i].name == 'serafuku' && target.hasSex('male', target))) num2++;
							}
							if (num1 >= num2 && num1 > cardsj.length - num1) return '判定区';
							else if (num1 <= num2 && num2 > cardse.length - num2) return '装备区';
							return false;
						}
						else {
							var cardsj = target.getCards('j');
							var cardse = target.getCards('e');
							var num1 = 0;
							var num2 = 0;
							for (var i = 0; i < cardsj.length; i++) {
								if (get.tag(cardsj[i], 'delay') == 'good') num1++;
							}
							for (var i = 0; i < cardse.length; i++) {
								if (cardse[i].name == 'yinfengyi' || cardse[i].name == 'yonglv' || cardse[i].name == 'duanjian' || (cardse[i].name == 'serafuku' && target.hasSex('male', target))) num2++;
							}
							num2 = cardse.length - num2;
							if (num1 >= num2 && num1 > cardsj.length - num1) return '判定区';
							else if (num1 <= num2 && num2 > cardse.length - num2) return '装备区';
							else return false;
						}
					}).set('prompt', '弃置目标的所有装备区或判定区的所有牌');
					'step 1'
					if (result.control == '装备区') {
						game.log('#b' + get.translation(target), '弃置了' + result.control + '的所有牌');
						target.discard(target.getCards('e', function (card) {
							return lib.filter.cardDiscardable(card, target, 'Saojiao');
						}));
					}
					else if (result.control == '判定区') {
						game.log('#b' + get.translation(target), '弃置了' + result.control + '的所有牌');
						target.discard(target.getCards('j', function (card) {
							return lib.filter.cardDiscardable(card, target, 'Saojiao');
						}));
					}
				},
				ai: {
					basic: {
						order: 11,
						useful: 2,
						value: 7,
					},
					result: {
						target: function (player, target) {
							if (!target) return false;
							var att = get.attitude(player, target);
							if (att < 0) {
								var cardsj = target.getCards('j');
								var cardse = target.getCards('e');
								var num1 = 0;
								var num2 = 0;
								for (var i = 0; i < cardsj.length; i++) {
									if (get.tag(cardsj[i], 'delay') == 'bad') num1++;
								}
								for (var i = 0; i < cardse.length; i++) {
									if (cardse[i].name == 'yinfengyi' || cardse[i].name == 'yonglv' || cardse[i].name == 'duanjian' || (cardse[i].name == 'serafuku' && target.hasSex('male', target))) num2++;
								}
								return Math.min(num1 - (cardsj.length - num1), (cardse.length - num2) - num2);
							}
							else {
								var cardsj = target.getCards('j');
								var cardse = target.getCards('e');
								var num1 = 0;
								var num2 = 0;
								for (var i = 0; i < cardsj.length; i++) {
									if (get.tag(cardsj[i], 'delay') == 'good') num1++;
								}
								for (var i = 0; i < cardse.length; i++) {
									if (cardse[i].name == 'yinfengyi' || cardse[i].name == 'yonglv' || cardse[i].name == 'duanjian' || (cardse[i].name == 'serafuku' && target.hasSex('male', target))) num2++;
								}
								return Math.max(num1 - (cardsj.length - num1), num2 - (cardse.length - num2));
							}
						},
					},
					tag: {
						discard: 2,
						loseCard: 2,
					}
				}
			},

			//七星牌
			BJX_ziwei: {
				type: 'qixing',
				derivation: 'beijixing',
				fullskin: true,
			},
			BJX_tianshu: {
				type: 'qixing',
				derivation: 'beijixing',
				fullskin: true,
			},
			BJX_tianxuan: {
				type: 'qixing',
				derivation: 'beijixing',
				fullskin: true,
			},
			BJX_tianji: {
				type: 'qixing',
				derivation: 'beijixing',
				fullskin: true,
			},
			BJX_tianquan: {
				type: 'qixing',
				derivation: 'beijixing',
				fullskin: true,
			},
			BJX_yuheng: {
				type: 'qixing',
				derivation: 'beijixing',
				fullskin: true,
			},
			BJX_kaiyang: {
				type: 'qixing',
				derivation: 'beijixing',
				fullskin: true,
			},
			BJX_yaoguang: {
				type: 'qixing',
				derivation: 'beijixing',
				fullskin: true,
			},
			//诡牌
			Mchenshi: {
				audio: true,
				fullskin: true,
				derivation: 'zhijiangemeng',
				type: 'trick',
				chongzhu: true,
				ai: {
					basic: {
						useful: 0,
						value: 0,
					},
				},
				content: function () {
				},
			},
			Myishi: {
				audio: true,
				fullskin: true,
				derivation: 'zhijiangemeng',
				type: 'trick',
				chongzhu: true,
				ai: {
					basic: {
						useful: 0,
						value: 0,
					},
				},
				content: function () {
				},
			},
			Mhuadeng: {
				audio: true,
				fullskin: true,
				derivation: 'zhijiangemeng',
				type: 'trick',
				chongzhu: true,
				ai: {
					basic: {
						useful: 0,
						value: 0,
					},
				},
				content: function () {
				},
			},
		},
		skill: {
			yuyong: {
				audio: 3,
				frequent: true,
				trigger: { player: 'damageAfter' },
				content: function () {
					var num = player.getHistory('damage', null).length;
					if (num)
						player.draw(num);
					//贝拉3
					event.num = num;
					player.checkChallenge(event, 'CLbeila3', 'character', 'onehun');
				},
				ai: {
					maixie: true,
					"maixie_hp": true,
					effect: {
						target: function (card, player, target) {
							if (player.hasSkillTag('jueqing', false, target)) return [1, -1];
							var num = player.getHistory('damage', null).length;
							if (get.tag(card, 'damage') && player != target) return [1, 1 - num * 0.2];
						},
					},
				}
			},
			wuhun: {
				audio: 4,
				group: ['wuhun2', 'wuhun1'],
				filter: function (event, player) {
					if (player.storage.wuhun >= player.maxHp - player.hp + 1) return false;
					return player.countCards('h') > 0;
				},
				discard: false,
				lose: false,
				delay: false,
				enable: 'phaseUse',
				filterCard: function (card) {
					return get.type(card) != 'basic';
				},
				filterTarget: function (card, player, target) {
					return player != target && player.canUse({ name: 'wudou', cards: ui.selected.cards }, target);
				},
				position: 'h',
				content: function () {
					player.storage.wuhun++;
					player.useCard({ name: 'wudou' }, target, cards).audio = false;
				},
				prompt: '将一张非基本手牌当作舞斗使用',
				check: function (card) {
					if (card.name == 'du') return false;
					return 6 - get.value(card)
				},
				ai: {
					threaten: 1.2,
					result: {
						target: function (player, target) {
							if (get.attitude(player, target) >= 0) return -2;
							var num1 = 0;
							var num2 = 0;
							var hs1 = player.CountCardUsable();
							var hs2 = target.CountCardUsable();
							if (hs1 > hs2) return -1.5;
							if (hs1 < hs2) return 1.5;
							return 0;
						},
						player: function (player, target, card) {
							if (get.attitude(player, target) >= 0) return -2;
							var num1 = 0;
							var num2 = 0;
							var hs1 = player.CountCardUsable();
							var hs2 = target.CountCardUsable();
							if (hs1 < hs2) return -1.5;
							if (hs1 > hs2) return 1.5;
							return 0;
						}
					},
					order: 8,
				}
			},
			wuhun1: {
				forced: true,
				popup: false,
				trigger: { player: 'phaseUseBegin' },
				init: function (player, skill) {
					if (!player.storage[skill]) player.storage[skill] = 0;
				},
				content: function () {
					player.storage.wuhun = 0;
				},
			},
			wuhun2: {
				audio: 2,
				enable: ['chooseToUse', 'chooseToRespond'],
				filter: function (event, player) {
					if (event.getParent() && event.getParent().card && event.getParent().card.name == 'wudou')
						return true;
					if (event.getParent(2) && event.getParent(2).card && event.getParent(2).card.name == 'wudou')
						return true;
					if (event.getParent(3) && event.getParent(3).card && event.getParent(3).card.name == 'wudou')
						return true;
					if (event.getParent(4) && event.getParent(4).card && event.getParent(4).card.name == 'wudou')
						return true;
					return false;
				},
				filterCard: function (card, player) {
					if (get.zhu(player, 'shouyue')) return true;
					return get.color(card) == 'red';
				},
				position: 'hes',
				viewAs: { name: 'sha' },
				prompt: '将一张红色牌当杀打出',
				check: function (card) {
					return 6 - get.value(card)
				},
				ai: {
					skillTagFilter: function (player) {
						if (get.zhu(player, 'shouyue')) {
							if (!player.countCards('hes')) return false;
						}
						else {
							if (!player.countCards('hes', { color: 'red' })) return false;
						}
					},
					respondSha: true,
				}
			},
			yuemian: {
				unique: true,
				audio: 'yuemian2',
				global: 'yuemian2',
				zhuSkill: true,
				round: 1,
				content: function () {

				},
			},
			yuemian2: {
				audio: 2,
				enable: 'phaseUse',
				discard: false,
				lose: false,
				delay: false,
				line: true,
				direct: true,
				clearTime: true,
				/*	prepare: function (cards, player, targets) {
						targets[0].logSkill('yuemian');
					},*/
				prompt: function () {
					var player = _status.event.player;
					var list = game.filterPlayer(function (target) {
						return target != player && target.hasZhuSkill('yuemian', player);
					});
					var str = '将一张非基本牌交给' + get.translation(list);
					if (list.length > 1) str += '中的一人';
					return str;
				},
				filter: function (event, player) {
					if (player.group != 'hun') return false;
					if (player.countCards('h', { type: 'trick' }) + player.countCards('h', { type: 'equip' }) + player.countCards('h', { type: 'delay' }) == 0) return 0;
					return game.hasPlayer(function (target) {
						return target != player && target.hasZhuSkill('yuemian', player) && !target.hasSkill('yuemian3') && (game.roundNumber - target.storage.yuemian_roundcount) >= 1;
					});
				},
				filterCard: function (card) {
					return get.type(card) != 'basic';
				},
				log: false,
				visible: true,
				filterTarget: function (card, player, target) {
					return target != player && target.hasZhuSkill('yuemian', player) && !target.hasSkill('yuemian3');
				},
				//usable:1,
				//forceaudio:true,
				content: function () {
					target.gain(cards, player, 'giveAuto');
					target.useSkill('yuemian');
					//	target.addTempSkill('yuemian3', 'phaseUseEnd');
				},
				ai: {
					expose: 0.3,
					order: 10,
					result: {
						target: 5
					}
				}
			},
			yuemian3: {},

			daican: {
				audio: 4,
				enable: 'phaseUse',
				discard: false,
				lose: false,
				delay: 0,
				init: function (player, skill) {
					if (!player.storage[skill]) player.storage[skill] = [];
				},
				filterTarget: function (card, player, target) {
					return !player.storage.daican.contains(target.name);
				},

				filter: function (event, player) {
					return !player.storage.daican2;
				},
				group: 'daican2',
				content: function () {
					'step 0'
					//珈乐2 
					player.checkChallenge(event, 'CLjiale2', 'character', 'onehun');
					player.storage.daican.push(target.name);
					target.draw(2);
					target.chooseToDiscard('弃置若干张牌，若弃置点数之和不小于13，可令珈乐再次发动该技能', [1, Infinity], true, 'he').ai = function (card) {
						if (get.attitude(target, player) > 0) {
							if (!event.yes) {
								var n = target.countCards('he');
								var cards = target.getCards('he');
								var w = [];
								var v = [];
								for (var i = 1; i <= n; i++) {
									w[i] = get.number(cards[i - 1]);
									v[i] = get.value(cards[i - 1]);
									if (cards[i - 1].name == 'du')
										v[i] = 0;
								}

								var path = new Array();
								for (var i = 0; i <= n; i++) {
									path[i] = new Array(14);
									for (var j = 0; j <= 13; j++) {
										path[i][j] = 0;
									}
								}
								var dp = [];
								for (var i = 0; i <= 13; i++) {
									dp[i] = 100;
								}
								for (var i = 1; i <= n; i++) {
									for (var j = 13; j >= 1; j--) {
										//		console.log(i,j,w[i],v[i],dp);
										if (j <= w[i] && dp[j] > v[i]) {
											path[i][j] = 1;
											dp[j] = v[i];
										}
										else if (j > w[i] && dp[j] > dp[j - w[i]] + v[i]) {
											path[i][j] = 1;
											dp[j] = dp[j - w[i]] + v[i];
										}
									}
								}
								event.list = [];
								var i = n, j = 13;
								while (i && j) {
									if (path[i][j] == 1) {
										event.list.push(cards[i - 1]);
										j -= w[i];
									}
									i--;
								}
								event.yes = true;
							}
							if (event.yes) {
								if (!event.list.length) {
									if (ui.selected.cards.length) return false;
									return 7 - get.value(card);
								}
								else {
									for (var i = 0; i < event.list.length; i++) {
										if (event.list[i] == card)
											return 10;
									}
									return false;
								}
							}
						}
						else {
							if (ui.selected.cards.length) return false;
							return 7 - get.value(card);
						}

					}
					'step 1'
					if (result.cards) {
						var num = 0;
						for (var i = 0; i < result.cards.length; i++) {
							num += result.cards[i].number;
						}
						if (num >= 13) {

						}
						else
							player.storage.daican2 = true;
					}
				},
				ai: {
					order: 15,
					result: {
						target: 2,
						player: function (player) {
							var num = 0;
							var players = game.filterPlayer();
							for (var i = 0; i < players.length; i++) {
								var att = get.attitude(player, players[i]);
								if (att > 0) num++;
							}
							return num / 2;
						}
					},
					threaten: 2.0
				}
			},
			daican2: {
				forced: true,
				popup: false,
				trigger: { player: 'phaseUseBegin' },
				filter: function (event, player) {
					return true;
				},
				content: function () {
					player.storage.daican = [];
					player.storage.daican2 = false;
				}

			},
			anchao: {
				unique: true,
				limited: true,
				audio: 2,
				enable: 'phaseUse',
				filter: function (event, player) {
					return !player.storage.anchao;
				},
				init: function (player) {
					player.storage.anchao = false;
				},
				mark: true,
				intro: {
					content: 'limited'
				},
				skillAnimation: true,
				animationColor: 'thunder',
				content: function () {
					'step 0'
					event.num = 0;
					player.storage.anchao = true;
					player.awakenSkill('anchao');
					event.nowplayer = player;
					'step 1'
					event.player = event.player.next;
					if (event.player == event.nowplayer) {
						event.finish();
					}
					else {
						var ph = event.nowplayer.countCards('h');
						if (event.player.countCards('h') > ph)
							event.player.damage(1, event.nowplayer);
						if (event.player.countCards('h') < ph) {
							//珈乐3 
							event.num += ph - event.player.countCards('h');
							event.nowplayer.checkChallenge(event, 'CLjiale3', 'character', 'onehun');

							event.player.draw(ph - event.player.countCards('h'));
						}

					}
					'step 2'
					event.goto(1);
				},
				ai: {
					order: function (skill, player) {
						var ph = player.countCards('h');
						var players = game.filterPlayer();
						var num1 = 0;
						var num2 = 0;
						for (var i = 0; i < players.length; i++) {
							if (players[i] != player && get.attitude(player, players[i]) > 0 && ph > players[i].countCards('h'))
								num1++;
							if (players[i] != player && get.attitude(player, players[i]) < 0 && ph < players[i].countCards('h'))
								num2++;
						}
						if (num1 > num2) return 14;
						else if (num1 < num2) return 1;
					},
					result: {
						player: function (player) {

							var ph = player.countCards('h');
							var players = game.filterPlayer();
							var num1 = 0;
							var num = 0;
							for (var i = 0; i < players.length; i++) {
								var th = players[i].countCards('h');
								var att = get.attitude(player, players[i]);
								if (att > 0) {
									if (th > ph) {
										if (players[i].hasSkillTag('maixie')) num += 1;
										if (players[i].hp == 1) num -= 2;
										num -= 1.5;
									}
									else {
										num += ph - th;
									}
								}
								else if (att < 0) {
									if (th > ph) {
										if (players[i].hasSkillTag('maixie')) num -= 1;
										if (players[i].hp == 1) num += 2;
										num += 1.5;
									}
									else {
										num -= ph - th;
									}
								}
								else if (att == 0) num1++;
							}
							if (num1 >= 3) return -10;
							return num;

						}
					}
				}
			},

			ranyou: {
				locked: false,
				direct: true,
				audio: 2,
				audioname: ['bolilingran'],
				trigger: { global: 'damageEnd' },
				filter: function (event, player) {
					return player.countCards('h') > 0 && player != event.player && event.player.isAlive();;
				},
				content: function () {
					'step 0'
					player.chooseCard('h', '是否将一张牌交给<span class="bluetext">' + get.translation(trigger.player) + '</span>').set('ai', function (card) {
						if (get.attitude(player, trigger.player) < 0 && card.name == 'du') return 20;
						if (get.attitude(player, trigger.player) <= 0) return false;
						return 7 - get.value(card);
					});
					"step 1"
					if (result.cards) {
						player.logSkill('ranyou', trigger.player);

						//嘉然5
						if (player.name == 'jiaran' && trigger.player.name == 'xiangwan' && result.cards[0].name == 'du') {
							player.checkChallenge(event, 'CLjiaran5', 'character', 'onehun');
						}

						trigger.player.gain(result.cards, player, 'giveAuto');
						//嘉然2
						if (player.name == 'jiaran') {
							player.checkChallenge(event, 'CLjiaran2', 'character', 'onehun');
						}

						player.addMark('ranyou');
					}
				},
				ai: {
					expose: 0.2,
				},
				markimage:'image/mark/sheng.png',
				intro: {
					name: "圣",
					content: '共有$个标记',
				},
			},
			huamo: {
				locked: false,
				direct: true,
				audio: 2,
				trigger: { global: 'useCardAfter' },
				filter: function (event, player) {
					if (!event.cards[0]) return false;
					return (!player.hasSkill('huamo2') && player != event.player && get.type(event.card) != 'delay' && event.card.isCard && get.position(event.cards[0]) == 'd' && event.cards.length == 1 && player.hasCard(function (card) {
						return get.suit(event.cards[0]) == get.suit(card);
					}, 'h'));
				},
				content: function () {
					'step 0'
					player.chooseToDiscard('弃置一张' + get.translation(get.suit(trigger.card)) + '手牌，然后获得<span class="yellowtext">' + get.translation(trigger.card) + '</span>', function (card) {
						var trigger = _status.event.getTrigger();
						return get.suit(trigger.card) == get.suit(card);
					}).set('ai', function (card) {
						if (player.countCards('h', { name: 'shan' }) > 0 && trigger.card == 'shan') return false;
						return get.value(card) < get.value(trigger.card) && get.name(card) != 'du';
					});
					'step 1'
					if (result.cards) {
						player.addTempSkill('huamo2');
						player.gain(trigger.cards, 'gain2');
						player.logSkill('huamo');
						//嘉然3
						if (player.name == 'jiaran') {
							player.checkChallenge(event, 'CLjiaran3', 'character', 'onehun');
						}

						if (player.hasSkill('shuangmian'))
							player.addMark('huamo');
					}

				},
				ai: {
					expose: 0.2,
					threaten: 1.1,
				},
				markimage:'image/mark/mo.png',
				intro: {
					name: "魔",
					content: '共有$个标记',
				},
			},
			huamo2: {},
			shuangmian: {
				audio: 2,
				group: 'shuangmian2',
				trigger: { player: ['phaseBegin','phaseEnd'] },
				prompt2: '是否弃置一个“圣”标记并摸一张牌？',
				filter: function (event, player) {
					return player.hasMark('ranyou');
				},
				content: function () {
					player.removeMark('ranyou');
					player.draw();
				},
				check: function (event, player) {
					return true;
				},
			},
			/*shuangmian: {
				audio: 2,
				group: 'shuangmian2',
				trigger: { player: 'phaseDrawBegin2' },
				prompt2: '是否弃置两个“圣”标记并额外摸两张牌？',
				filter: function (event, player) {
					return !event.numFixed && player.countMark('ranyou') >= 2;
				},
				content: function () {
					player.removeMark('ranyou', 2);
					trigger.num += 2;
				},
				check: function (event, player) {
					return true;
				},
			},
			*/
			shuangmian2: {
				audio: 2,
				direct: true,
				trigger: {
					player: "useCard2",
				},
				filter: function (event, player) {
					var type = get.type(event.card);
					//
					return player.countMark('huamo') >= 2 && (type == 'basic' || type == 'trick') && event.targets && game.hasPlayer(function (current) {
						return !event.targets.contains(current) && player.canUse(event.card, current);
					}) && _status.currentPhase == player;
				},
				content: function () {
					'step 0'
					player.chooseTarget('是否弃置两个“魔”标记并选择<span class="yellowtext">' + get.translation(trigger.card) + '</span>的额外一名目标？', function (card, player, target) {
						var trigger = _status.event.getTrigger();
						return player.canUse(trigger.card, target) && !trigger.targets.contains(target);
					}).set('ai', function (target) {
						return get.effect(target, { name: trigger.card.name }, player, player) > 0;
					});
					'step 1'
					if (result.targets) {
						player.logSkill('shuangmian2');
						player.removeMark('huamo', 2);
						player.line(result.targets);
						trigger.targets.add(result.targets[0]);
					}
				},
			},

			danda: {
				audio: 4,
				usable: 1,
				filter: function (event, player) {
					if (player.storage.danda1 || player.storage.danda2 || player.storage.danda3) return false;
					return player.countCards('h', { type: 'basic' }) > 0;
				},
				discard: false,
				lose: false,
				delay: 0,
				logTarget: 'target',
				enable: 'phaseUse',
				filterCard: function (card) {
					return get.type(card) == 'basic';
				},
				filterTarget: function (card, player, target) {
					return player != target&&player.canUse({ name: 'shunshou', cards: ui.selected.cards }, target,false);
				},
				content: function () {
					//乃琳2
					player.checkChallenge(event, 'CLnailin2', 'character', 'onehun');


					player.useCard({ name: 'shunshou', storage: 'danda' }, target, cards).audio = false;
				},
				check: function (card) {
					return 7 - get.value(card);
				},
				position: 'h',
				prompt: '将一张基本牌当顺手牵羊使用',
				check: function (card) { return 8 - get.value(card) },
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							return get.effect(target, { name: 'shunshou' }, player, target);
						}
					},
					threaten: 1.8
				}
			},
			danda1: {
				audio: 'danda',
				usable: 1,
				filter: function (event, player) {
					return player.countCards('h', { type: 'basic' }) > 0;
				},
				discard: false,
				lose: false,
				delay: 0,
				logTarget: 'target',
				enable: 'phaseUse',
				filterCard: function (card) {
					return get.type(card) == 'basic';
				},
				filterTarget: function (card, player, target) {
					return player != target&&player.canUse({ name: 'tuixinzhifu', cards: ui.selected.cards }, target,false);
				},
				content: function () {
					//乃琳2
					player.checkChallenge(event, 'CLnailin2', 'character', 'onehun');

					player.useCard({ name: 'tuixinzhifu' ,storage:'danda'}, target, cards).audio = false;
				},
				check: function (card) {
					return 7 - get.value(card);
				},
				position: 'h',
				prompt: '将一张基本牌当推心置腹使用',
				check: function (card) { return 8 - get.value(card) },
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							return get.effect(target, { name: 'tuixinzhifu' }, player, target);
						}
					},
					threaten: 1.8
				}
			},
			danda2: {
				audio: 'danda',
				usable: 1,
				filter: function (event, player) {
					return player.countCards('h', { type: 'basic' }) > 0;
				},
				discard: false,
				lose: false,
				delay: 0,
				enable: 'phaseUse',
				filterCard: function (card) {
					return get.type(card) == 'basic';
				},
				filterTarget: function (card, player, target) {
					return player != target&&player.canUse({ name: 'shunshou', cards: ui.selected.cards }, target,false);
				},
				content: function () {
					//乃琳2
					player.checkChallenge(event, 'CLnailin2', 'character', 'onehun');

					player.useCard({ name: 'shunshou', storage: 'danda' }, target, cards).audio = false;
				},
				check: function (card) {
					return 7 - get.value(card);
				},
				logTarget: 'target',
				position: 'h',
				prompt: '将一张基本牌当顺手牵羊使用',
				check: function (card) { return 8 - get.value(card) },
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							return get.effect(target, { name: 'shunshou' }, player, target);
						}
					},
					threaten: 1.8
				},
				group: 'danda2_gaintime',
				subSkill: {
					gaintime: {
						direct: true,
						trigger: { player: 'gainAfter' },
						filter: function (event, player) {
							if (event.getParent(2) && event.getParent(2).card && event.getParent(2).card.name == 'shunshou' && event.getParent(2).card.storage == 'danda')
								return game.hasPlayer(function (current) {
									return current.hasSex('female', player);
								});
							return false;
						},
						content: function () {
							'step 0'
							player.chooseTarget('选择一名女性角色', function (card, player, target) {
								if (target == player) return false;
								if (target.hasSex('female', player)) return true;
							}).set('ai', function (target) {
								player = _status.event.player;
								var att = get.attitude(player, target);
								var num = -4;
								for (var i = 0; i < trigger.cards.length; i++)
									num += get.value(trigger.cards[i]);
								var eff = get.damageEffect(target, player, player);
								console.log(eff, att, num);
								return -att + eff - num;
							});
							'step 1'
							if (result.bool) {
								result.targets[0].gain(trigger.cards, player, 'giveAuto');
								result.targets[0].autoDamage(1, player);
							}

						},
					},
				},

			},
			danda3: {
				audio: 'danda',
				usable: 1,
				filter: function (event, player) {
					return player.countCards('h', { type: 'basic' }) > 0;
				},
				discard: false,
				lose: false,
				delay: 0,
				enable: 'phaseUse',
				filterCard: function (card) {
					return get.type(card) == 'basic';
				},
				filterTarget: function (card, player, target) {
					return player != target&&player.canUse({ name: 'shunshou', cards: ui.selected.cards }, target,false);
				},
				content: function () {
					//乃琳2
					player.checkChallenge(event, 'CLnailin2', 'character', 'onehun');

					player.useCard({ name: 'shunshou', storage: 'danda' }, target, cards).audio = false;
				},
				check: function (card) {
					return 7 - get.value(card);
				},
				logTarget: 'target',
				position: 'h',
				prompt: '将一张基本牌当顺手牵羊使用',
				check: function (card) { return 8 - get.value(card) },
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							return get.effect(target, { name: 'shunshou' }, player, target);
						}
					},
					threaten: 1.8
				},
				group: 'danda3_gaintime',
				subSkill: {
					gaintime: {
						direct: true,
						trigger: { player: 'gainAfter' },
						filter: function (event, player) {
							if (event.getParent(2) && event.getParent(2).card && event.getParent(2).card.name == 'shunshou' && event.getParent(2).card.storage == 'danda')
								return game.hasPlayer(function (current) {
									return current.hasSex('female', player) && current.hp != current.maxHp;
								});
							return false;
						},
						content: function () {
							'step 0'
							player.chooseTarget('选择一名女性角色', function (card, player, target) {
								if (target.hp == target.maxHp) return false;
								if (target.hasSex('female', player)) return true;
							}).set('ai', function (target) {
								player = _status.event.player;
								if (!target.hasSex('female', player)) return false;
								var att = get.attitude(player, target);
								if (att <= 0) return false;
								var num = -4;
								for (var i = 0; i < trigger.cards.length; i++)
									num += get.value(trigger.cards[i]);
								return num + att / 2 + 3 - target.hp;
							});
							'step 1'
							if (result.bool) {
								player.discard(trigger.cards);
								result.targets[0].recover(1, 'star');
							}

						},

					},
				},
			},
			qingchun: {
				locked: true,
				forced: true,
				popup:false,
				trigger: { player: 'useCardToPlayered' },
				filter: function (event, player) {
					if (event.targets.length != 1) return false;
					if (event.target == player) return false;
					if (!event.card) return false;
					if (get.type(event.card) != 'trick' && get.type(event.card) != 'basic') return false;
					if (event.target.storage.qingchun1 && get.type(event.card) == 'trick') return false;
					if (event.target.storage.qingchun2 && get.type(event.card) == 'basic') return false;
					return true;
				},
				preHidden: true,
				content: function () {
					if (get.type(trigger.card) == 'trick') {
						if (!trigger.target.storage.qingchun1 && !trigger.target.storage.qingchun2 && trigger.target.sex == 'male') player.draw();
						else if (trigger.target.storage.qingchun2) player.draw();
						delete trigger.target.storage.qingchun2;
						if(trigger.card.storage=='danda'){player.logSkill('qingchun',trigger.target);}
						else player.logSkill('qingchun_female',trigger.target);
						trigger.target.removeSkill('qingchun2');
						trigger.target.unmarkSkill('qingchun2');
						trigger.target.addSkill('qingchun1');
						trigger.target.storage.qingchun1 = player;
						trigger.target.markSkill('qingchun1');
					}
					else if (get.type(trigger.card) == 'basic') {
						if (!trigger.target.storage.qingchun1 && !trigger.target.storage.qingchun2 && trigger.target.sex == 'female') player.draw();
						else if (trigger.target.storage.qingchun1) player.draw();
						delete trigger.target.storage.qingchun1;
						if(trigger.card.storage=='danda'){player.logSkill('qingchun',trigger.target);}
						else player.logSkill('qingchun_male',trigger.target);
						trigger.target.removeSkill('qingchun1');
						trigger.target.unmarkSkill('qingchun1');
						trigger.target.addSkill('qingchun2');
						trigger.target.storage.qingchun2 = player;
						trigger.target.markSkill('qingchun2');
					}
					//乃琳3
					player.checkChallenge(event, 'CLnailin3', 'character', 'onehun');
					//	trigger.target.draw();
					//	trigger.target.storage.qingchun=player;
					//	trigger.target.addSkill('qingchun1');
					//	trigger.target.markSkill('qingchun');
				},
				ai: {
					effect: {
						player: function (card, player, target) {
							if (!target) return 1;
							if (target.hasSkill('qingchun1') && target.storage.qingchun1 && get.type(card) == 'basic') return 1.5;
							if (target.hasSkill('qingchun2') && target.storage.qingchun2 && get.type(card) == 'trick') return 1.5;
							return 1;
						},
					}
				},
				subSkill:{
					male:{
						audio:2,
						content:{},
					},
					female:{
						audio:2,
						content:{},
					},
				}
			},
			qingchun1: {
				mod: {
					sex: function (player, target, sex) {
						if (target.storage.qingchun1 == player) {
							return 'female';
						}
						return sex;
					},
				},
				marktext: "♀",
				intro: {
					name: "7%",
					content: function (storage, player, skill) {
						return "你被乃琳视为女性";
					},
				},
			},
			qingchun2: {
				mod: {
					sex: function (player, target, sex) {
						if (target.storage.qingchun2 == player) {
							return 'male';
						}
						return sex;
					},
				},
				marktext: "♂",
				intro: {
					name: "93%",
					content: function (storage, player, skill) {
						return "你被乃琳视为男性";
					},
				},
			},
			naiao: {
				audio: 3,
				trigger: { player: 'phaseZhunbeiBegin' },
				filter: function (event, player) {
					delete player.storage.danda1;
					delete player.storage.danda2;
					delete player.storage.danda3;
					return true;
				},
				check: function (event, player) {
					return true;
				},
				content: function () {
					'step 0'
					event.nowplayer = player;
					event.player = player;
					event.num1 = 0;
					event.num2 = 0;
					event.num3 = 0;
					'step 1'
					if (event.player.hasSex('male', event.nowplayer) == true) {
						event.player.chooseControlList('乃琳想要修改【胆大】，她上了投票器，目前的票数是：' + '①：' + event.num1 + ' ②：' + event.num2 + ' ③：' + event.num3, ['出牌阶段限一次，你可以将一张基本牌当【推心置腹】使用（无距离限制）。', '出牌阶段限一次，你可以将一张基本牌当【顺手牵羊】使用（无距离限制）。获得牌时，你可以将其交给一名其他女性角色，然后对其造成1点伤害。', '出牌阶段限一次，你可以将一张基本牌当【顺手牵羊】使用（无距离限制）。获得牌时，你可以弃置之，然后令一名女性角色回复1点极星体力。'], function (event, player) {
							return Math.floor(Math.random() * 3);
						});
					}
					else {
						event.goto(3);
					}
					'step 2'
					if (result.index == 0) event.num1++;
					else if (result.index == 1) event.num2++;
					else if (result.index == 2) event.num3++;
					'step 3'
					event.player = event.player.next;
					if (event.player == event.nowplayer) event.goto(4);
					else event.goto(1);
					'step 4'
					game.log('最终的票数是：', '#y' + '①：' + event.num1, '#y' + ' ②：' + event.num2, '#y' + ' ③：' + event.num3);
					if (event.num1 >= event.num2 && event.num1 >= event.num3) {
						game.log('#b' + '乃琳', '将技能修改为了①');
						event.nowplayer.addTempSkill('danda1');
						event.nowplayer.storage.danda1 = true;
					}
					else if (event.num2 >= event.num1 && event.num2 >= event.num3) {
						game.log('#b' + '乃琳', '将技能修改为了②');
						event.nowplayer.addTempSkill('danda2');
						event.nowplayer.storage.danda2 = true;
					}
					else if (event.num3 >= event.num1 && event.num3 >= event.num2) {
						game.log('#b' + '乃琳', '将技能修改为了③');
						event.nowplayer.addTempSkill('danda3');
						event.nowplayer.storage.danda3 = true;
					}
				},
			},

			taiji: {
				audio: 2,
				dutySkill: true,
				forced: true,
				trigger: { player: 'phaseJudgeBefore' },
				filter: function (event, player) {
					return true;
				},
				content: function () {
					trigger.cancel();
				},
				derivation: ['benghuai', 'dahuo'],
				group: ['taiji_achieve', 'taiji_fail'],
				ai: {
					noj: true,
					effect: {
						target: function (card, player, target) {
							var att = get.attitude(target, player);
							if (att >= 0 && get.type(card) == 'delay') return 2;
							else if (get.type(card) == 'delay') return 0;
							return 1;
						},
					},
				},
				subSkill: {
					achieve: {
						audio: 'taiji',
						trigger: { player: 'phaseBegin' },
						forced: true,
						skillAnimation: true,
						animationColor: 'star',
						filter: function (event, player) {
							if (player.countCards('j') >= 4) return true;
							return false;
						},
						content: function () {
							'step 0'
							//阿草3
							player.checkChallenge(event, 'CLacao3', 'character', 'onehun');

							game.log(player, '成功完成使命');
							player.awakenSkill('taiji');
							player.addSkillLog('benghuai');
							player.addSkillLog('dahuo');
							player.gainMaxHp(4);
							'step 1'
							player.recover(4);
							'step 2'
							for (var i = 0; i < player.countCards('j'); i++)
								player.moveTargetCard(player, 'j');
						},
					},
					fail: {
						audio: 'taiji',
						trigger: { player: 'dying' },
						forced: true,
						content: function () {
							'step 0'
							game.log(player, '使命失败');
							player.awakenSkill('taiji');
							if (player.hp < 1) player.recover(1 - player.hp);
							'step 1'
							player.loseMaxHp();
							player.disableJudge();
						},
					},
				},
			},
			gaozui: {
				audio: 2,
				trigger: { player: ['damageEnd', 'loseHpEnd', 'loseMaxHpEnd'] },
				forced: true,
				content: function () {
					'step 0'
					//阿草2
					player.checkChallenge(event, 'CLacao2', 'character', 'onehun');

					event.cards = get.cards();
					player.showCards(event.cards);
					'step 1'
					var card = event.cards[0];
					player.gain(card, 'gain2');
					var str = card.name + '_delay';
					if (card.name == 'guaguliaodu') str = 'guagu_delay';
					if (get.type(card) == 'delay' && player.canAddJudge(card)) {
						player.useCard(player, card).audio = false;
						game.log('#b' + get.translation(player.name), '将', '#y' + get.translation(card.name), '置入了判定区');
					}
					else if ((get.cardtag(card, 'delay') || get.cardtag(card, 'delay_jiabu') || get.cardtag(card, 'delay_zhifang') || get.cardtag(card, 'delay_xiayu') || get.cardtag(card, 'delay_fengqing') || get.cardtag(card, 'delay_luanchuang')) && player.canAddJudge(str)) {
						player.useCard({ name: str, nature: card.nature }, player, event.cards).audio = false;
						game.log('#b' + get.translation(player.name), '将', '#y' + get.translation(card.name), '置入了判定区');
					}
					else
						game.log('#b' + get.translation(player.name), '获得了', '#y' + get.translation(card.name));
				},
				ai: {
					maixie: true,
					"maixie_hp": true,
					maixie_loseHp: true,
					threaten: 0.9,
				}
			},
			dahuo: {
				audio: 2,
				forced: true,
				trigger: { player: 'phaseJudgeBegin' },
				filter: function (event, player) {
					return true;
				},
				content: function () {
					if (!player.countCards('j')) {
						player.loseHp();
						event.finish();
					}
					else {
						player.moveTargetCard(player, 'j');
					}
				},
				ai: {
					threaten: 1.5,
					effect: {
						target: function (card, player, target) {
							if (get.type(card) == 'delay') return 0.5;
						}
					}
				},
			},
			benghuai: {
				audio: 1,
				trigger: { player: 'phaseJieshuBegin' },
				forced: true,
				check: function () {
					return false;
				},
				filter: function (event, player) {
					return !player.isMinHp() && !player.hasSkill('rejiuchi_air') && !player.hasSkill('oljiuchi_air');
				},
				content: function () {
					"step 0"
					player.chooseControl('baonue_hp', 'baonue_maxHp', function (event, player) {
						if (player.hp == player.maxHp) return 'baonue_hp';
						if (player.hp < player.maxHp - 1 || player.hp <= 2) return 'baonue_maxHp';
						return 'baonue_hp';
					}).set('prompt', '崩坏：失去1点体力或减1点体力上限');
					"step 1"
					if (result.control == 'baonue_hp') {
						player.loseHp();
					}
					else {
						player.loseMaxHp(true);
					}
				},
				ai: {
					threaten: 0.5,
					neg: true,
				}
			},

			neiping: {
				audio: 2,
				enable: 'phaseUse',
				discard: false,
				lose: false,
				delay: false,
				filter: function (event, player) {
					return player.countCards('hes', { color: 'black' }) > 0 && !player.hasSkill('neiping4');
				},
				prompt: '你可以将一张黑色牌当作【会者不难】使用',
				filterCard: function (card) {
					return get.color(card) == 'black';
				},
				position: 'hes',
				group: ['neiping2', 'neiping3'],
				filterTarget: function (card, player, target) {
					return player.canUse({ name: 'huizhe', cards: ui.selected.cards }, target);
				},
				check: function (card) {
					return 7 - get.value(card);
				},
				content: function () {
					if (target) {
						player.addTempSkill('neiping4');
						player.useCard({ name: 'huizhe' }, target, cards).audio = false;
						player.draw().gaintag = ['neiping'];
					}
					else {
					}
				},
				ai: {
					result: {
						target: function (player, target) {
							return get.effect(target, { name: 'huizhe' }, player, target);
						},
						player: 0.1,
					},
					threaten: 1.3,
					order: function (skill, player) {
						if (game.hasPlayer(function (current) {
							return player.canUse({ name: 'huizhe' }, current);
						}))
							return 10;
						else return 1;
					},
				}
			},
			neiping2: {
				mod: {
					cardname: function (card, player) {
						if (get.itemtype(card) == 'card' && card.hasGaintag('neiping')) return 'shebei';
					},
				},
			},
			neiping3: {
				mod: {
					aiValue: function (player, card, num) {
						if (get.name(card) != 'huizhe' && get.color(card) != 'black') return;
						var cards = player.getCards('hs', function (card) {
							return get.name(card) == 'huizhe' || get.color(card) == 'black';
						});
						cards.sort(function (a, b) {
							return (get.name(b) == 'huizhe' ? 1 : 2) - (get.name(a) == 'huizhe' ? 1 : 2);
						});
						var geti = function () {
							if (cards.contains(card)) {
								return cards.indexOf(card);
							}
							return cards.length;
						};
						if (get.name(card) == 'huizhe') return Math.min(num, [6, 4, 3][Math.min(geti(), 2)]) * 0.6;
						return Math.max(num, [6, 4, 3][Math.min(geti(), 2)]);
					},
					aiUseful: function () {
						return lib.skill.neiping3.mod.aiValue.apply(this, arguments);
					},
				},
				audio: 'neiping',
				enable: 'chooseToUse',
				discard: false,
				lose: false,
				delay: false,
				locked: false,
				filter: function (event, player) {
					return player.countCards('hes', { color: 'black' }) > 0 && event.getParent().name != 'phaseUse' && !player.hasSkill('neiping4');
				},
				prompt: '你可以将一张黑色牌当作【会者不难】使用',
				filterCard: function (card) {
					return get.color(card) == 'black';
				},
				position: 'hes',
				check: function (card) {
					return 7 - get.value(card);
				},
				viewAsFilter: function (player) {
					return player.countCards('hes', { color: 'black' }) > 0;
				},
				viewAs: {
					name: "huizhe",
				},
				onuse: function (result, player) {
					player.draw().gaintag = ['neiping'];
					player.addTempSkill('neiping4');
				},
				ai: {
					threaten: 1.3,
					respondDelay: true,
				}
			},
			neiping4: {},
			puge: {
				audio: 4,
				trigger: { player: 'phaseUseBegin' },
				filter: function (event, player) {
					if (!player.storage.disableSuit) player.storage.disableSuit = [];
					return player.storage.disableSuit.length < 4;
				},
				content: function () {
					'step 0'
					var list = ['club', 'spade', 'diamond', 'heart'];
					for (var i = 0; i < player.storage.disableSuit.length; i++)
						list.remove(player.storage.disableSuit[i]);
					player.chooseControl(list, true).set('ai', function (event, player) {
						var cnt = [0, 0, 0, 0];
						var cntv = [0, 0, 0, 0];
						var list = ['club', 'spade', 'diamond', 'heart'];
						for (var i = 0; i < player.storage.disableSuit.length; i++)
							list.remove(player.storage.disableSuit[i]);
						var cards = player.getCards('h');
						for (var i = 0; i < cards.length; i++) {
							if (!list.contains(get.suit(cards[i]))) continue;
							if (get.suit(cards[i]) == 'club') {
								cnt[0]++;
								if (get.value(cards[i]) <= 5)
									cntv[0]++;
							}
							else if (get.suit(cards[i]) == 'spade') {
								cnt[1]++;
								if (get.value(cards[i]) <= 5)
									cntv[1]++;
							}
							else if (get.suit(cards[i]) == 'diamond') {
								cnt[2]++;
								if (get.value(cards[i]) <= 5)
									cntv[2]++;
							}
							else if (get.suit(cards[i]) == 'heart') {
								cnt[3]++;
								if (get.value(cards[i]) <= 5)
									cntv[3]++;
							}
						}
						var num1 = 500;
						var num2 = 500;
						var choose;
						if (list.contains('club')) {
							if (num1 > cntv[0]) {
								num1 = cntv[0];
								num2 = cnt[0];
								choose = 'club';
							}
							else if (num1 == cntv[0] && num2 > cnt[0]) {
								num1 = cntv[0];
								num2 = cnt[0];
								choose = 'club';
							}

						}
						if (list.contains('spade')) {
							if (num1 > cntv[1]) {
								num1 = cntv[1];
								num2 = cnt[1];
								choose = 'spade';
							}
							else if (num1 == cntv[1] && num2 > cnt[1]) {
								num1 = cntv[1];
								num2 = cnt[1];
								choose = 'spade';
							}
						}
						if (list.contains('diamond')) {
							if (num1 > cntv[2]) {
								num1 = cntv[2];
								num2 = cnt[2];
								choose = 'diamond';
							}
							else if (num1 == cntv[2] && num2 > cnt[2]) {
								num1 = cntv[2];
								num2 = cnt[2];
								choose = 'diamond';
							}
						}
						if (list.contains('heart')) {
							if (num1 > cntv[3]) {
								num1 = cntv[3];
								num2 = cnt[3];
								choose = 'heart';
							}
							else if (num1 == cntv[3] && num2 > cnt[3]) {
								num1 = cntv[3];
								num2 = cnt[3];
								choose = 'heart';
							}
						}
						console.log(num1, num2, choose);
						return choose;
					}).set('prompt', '废除一种花色');
					'step 1'
					if (result.control) {
						player.disableSuit(result.control);
						player.chooseButton(['选择一张水母牌', [['Shaixiu', 'Smingan', 'Skeai', 'Saojiao'], 'vcard']], true, function (button) {
							var players = game.filterPlayer();
							var num1 = 0.1;
							var num2 = 0.1;
							var num3 = 0.1;
							var num4 = 0.1;
							for (var i = 0; i < players.length; i++) {
								if (get.distance(player, players[i], 'attack') <= 1)
									num2 = Math.max(num2, -get.effect(players[i], { name: 'Smingan' }, player, players[i]));
								if (get.distance(player, players[i]) <= 1)
									num4 = Math.max(num4, -get.effect(players[i], { name: 'Saojiao' }, player, players[i]));
								var att = get.attitude(player, players[i]);
								if (att > 0 && players[i].hp == 1) {
									num3 += 25;
								}

							}
							if (player.getCardUsable('Smingan') == 0) num = 0.1;
							num1 += player.storage.disableSuit.length * 4;
							num3 += player.storage.disableSuit.length * 4;
							if (!player.hasCard((card) => card.name == 'shan' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
							if (!player.hasCard((card) => card.name == 'wuxie' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
							if (!player.hasCard((card) => card.name == 'tao' && !card.hasGaintag('feichu'), 'h')) num3 += 7;
							if (player.hp != player.maxHp) num3 += 12 * (player.maxHp - player.hp);
							console.log(num1, num2, num3, num4);
							if (button.name == 'Shaixiu') return num1;
							if (button.name == 'Smingan') return num2;
							if (button.name == 'Skeai') return num3;
							if (button.name == 'Saojiao') return num4;
						});
					}
					else {
						event.finish();
					}
					'step 2'
					if (result.links[0][2] == 'Shaixiu') {
						var card = game.createCard('Shaixiu', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Smingan') {
						var card = game.createCard('Smingan', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Skeai') {
						var card = game.createCard('Skeai', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Saojiao') {
						var card = game.createCard('Saojiao', 'jellyfish');
						player.gain(card, 'draw');
					}
					game.log('#b' + get.translation(player), '获得了一张', '#y水母牌');
				},
				check: function (event, player) {
					var cnt = [0, 0, 0, 0];
					var cntv = [0, 0, 0, 0];
					var list = ['club', 'spade', 'diamond', 'heart'];
					if (player.storage.disableSuit.length > 2) return false;
					for (var i = 0; i < player.storage.disableSuit.length; i++)
						list.remove(player.storage.disableSuit[i]);
					var cards = player.getCards('h');
					for (var i = 0; i < cards.length; i++) {
						if (!list.contains(get.suit(cards[i]))) continue;
						if (get.suit(cards[i]) == 'club') {
							cnt[0]++;
							if (get.value(cards[i]) <= 5)
								cntv[0]++;
						}
						else if (get.suit(cards[i]) == 'spade') {
							cnt[1]++;
							if (get.value(cards[i]) <= 5)
								cntv[1]++;
						}
						else if (get.suit(cards[i]) == 'diamond') {
							cnt[2]++;
							if (get.value(cards[i]) <= 5)
								cntv[2]++;
						}
						else if (get.suit(cards[i]) == 'heart') {
							cnt[3]++;
							if (get.value(cards[i]) <= 5)
								cntv[3]++;
						}
					}
					var num1 = 100;
					var num2 = 100;
					if (list.contains('club')) {
						if (num1 > cntv[0]) {
							num1 = cntv[0];
							num2 = cnt[0];
						}
						else if (num1 == cntv[0] && num2 > cnt[0]) {
							num1 = cntv[0];
							num2 = cnt[0];
						}

					}
					if (list.contains('spade')) {
						if (num1 > cntv[1]) {
							num1 = cntv[1];
							num2 = cnt[1];
						}
						else if (num1 == cntv[1] && num2 > cnt[1]) {
							num1 = cntv[1];
							num2 = cnt[1];
						}
					}
					if (list.contains('diamond')) {
						if (num1 > cntv[2]) {
							num1 = cntv[2];
							num2 = cnt[2];
						}
						else if (num1 == cntv[2] && num2 > cnt[2]) {
							num1 = cntv[2];
							num2 = cnt[2];
						}
					}
					if (list.contains('heart')) {
						if (num1 > cntv[3]) {
							num1 = cntv[3];
							num2 = cnt[3];
						}
						else if (num1 == cntv[3] && num2 > cnt[3]) {
							num1 = cntv[3];
							num2 = cnt[3];
						}
					}
					if (num1 < 2) return true;
					if (num1 < 3 && num2 >= 2) return true;
					return false;
				},
				ai: {
					threaten: 1.8
				},
				group: ['puge2'],
				
			},
			puge2: {
				audio: 'puge',
				trigger: { player: 'damageEnd' },
				filter: function (event, player) {
					if (!player.storage.disableSuit) player.storage.disableSuit = [];
					return player.storage.disableSuit.length < 4;
				},
				content: function () {
					'step 0'
					var list = ['club', 'spade', 'diamond', 'heart'];
					for (var i = 0; i < player.storage.disableSuit.length; i++)
						list.remove(player.storage.disableSuit[i]);
					player.chooseControl(list, true).set('ai', function (event, player) {
						var cnt = [0, 0, 0, 0];
						var cntv = [0, 0, 0, 0];
						var list = ['club', 'spade', 'diamond', 'heart'];
						for (var i = 0; i < player.storage.disableSuit.length; i++)
							list.remove(player.storage.disableSuit[i]);
						var cards = player.getCards('h');
						for (var i = 0; i < cards.length; i++) {
							if (!list.contains(get.suit(cards[i]))) continue;
							if (get.suit(cards[i]) == 'club') {
								cnt[0]++;
								if (get.value(cards[i]) <= 5)
									cntv[0]++;
							}
							else if (get.suit(cards[i]) == 'spade') {
								cnt[1]++;
								if (get.value(cards[i]) <= 5)
									cntv[1]++;
							}
							else if (get.suit(cards[i]) == 'diamond') {
								cnt[2]++;
								if (get.value(cards[i]) <= 5)
									cntv[2]++;
							}
							else if (get.suit(cards[i]) == 'heart') {
								cnt[3]++;
								if (get.value(cards[i]) <= 5)
									cntv[3]++;
							}
						}
						var num1 = 500;
						var num2 = 500;
						var choose;
						if (list.contains('club')) {
							if (num1 > cntv[0]) {
								num1 = cntv[0];
								num2 = cnt[0];
								choose = 'club';
							}
							else if (num1 == cntv[0] && num2 > cnt[0]) {
								num1 = cntv[0];
								num2 = cnt[0];
								choose = 'club';
							}

						}
						if (list.contains('spade')) {
							if (num1 > cntv[1]) {
								num1 = cntv[1];
								num2 = cnt[1];
								choose = 'spade';
							}
							else if (num1 == cntv[1] && num2 > cnt[1]) {
								num1 = cntv[1];
								num2 = cnt[1];
								choose = 'spade';
							}
						}
						if (list.contains('diamond')) {
							if (num1 > cntv[2]) {
								num1 = cntv[2];
								num2 = cnt[2];
								choose = 'diamond';
							}
							else if (num1 == cntv[2] && num2 > cnt[2]) {
								num1 = cntv[2];
								num2 = cnt[2];
								choose = 'diamond';
							}
						}
						if (list.contains('heart')) {
							if (num1 > cntv[3]) {
								num1 = cntv[3];
								num2 = cnt[3];
								choose = 'heart';
							}
							else if (num1 == cntv[3] && num2 > cnt[3]) {
								num1 = cntv[3];
								num2 = cnt[3];
								choose = 'heart';
							}
						}
						console.log(num1, num2, choose);
						return choose;
					}).set('prompt', '废除一种花色');
					'step 1'
					if (result.control) {
						player.disableSuit(result.control);
						player.chooseButton(['选择一张水母牌', [['Shaixiu', 'Smingan', 'Skeai', 'Saojiao'], 'vcard']], true, function (button) {
							var players = game.filterPlayer();
							var num1 = 0.1;
							var num3 = 0.1;
							num1 += player.storage.disableSuit.length * 4;
							num3 += player.storage.disableSuit.length * 3;
							if (!player.hasCard((card) => card.name == 'shan' && !card.hasGaintag('feichu'), 'h')) num1 += 8;
							if (!player.hasCard((card) => card.name == 'wuxie' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
							if (!player.hasCard((card) => card.name == 'tao' && !card.hasGaintag('feichu'), 'h')) num3 += 7;
							if (player.hp != player.maxHp) num3 += 7 * (player.maxHp - player.hp);
							console.log(num1, num3);
							if (button.name == 'Shaixiu') return num1;
							if (button.name == 'Smingan') return false;
							if (button.name == 'Skeai') return num3;
							if (button.name == 'Saojiao') return false;
						});
					}
					else {
						event.finish();
					}
					'step 2'
					if (result.links[0][2] == 'Shaixiu') {
						var card = game.createCard('Shaixiu', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Smingan') {
						var card = game.createCard('Smingan', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Skeai') {
						var card = game.createCard('Skeai', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Saojiao') {
						var card = game.createCard('Saojiao', 'jellyfish');
						player.gain(card, 'draw');
					}
					game.log('#b' + get.translation(player), '获得了一张', '#y水母牌');
				},
				check: function (event, player) {
					var cnt = [0, 0, 0, 0];
					var cntv = [0, 0, 0, 0];
					var list = ['club', 'spade', 'diamond', 'heart'];
					if (player.storage.disableSuit.length > 2) return false;
					for (var i = 0; i < player.storage.disableSuit.length; i++)
						list.remove(player.storage.disableSuit[i]);
					var cards = player.getCards('h');
					for (var i = 0; i < cards.length; i++) {
						if (!list.contains(get.suit(cards[i]))) continue;
						if (get.suit(cards[i]) == 'club') {
							cnt[0]++;
							if (get.value(cards[i]) <= 5)
								cntv[0]++;
						}
						if (get.suit(cards[i]) == 'spade') {
							cnt[1]++;
							if (get.value(cards[i]) <= 5)
								cntv[1]++;
						}
						if (get.suit(cards[i]) == 'diamond') {
							cnt[2]++;
							if (get.value(cards[i]) <= 5)
								cntv[2]++;
						}
						if (get.suit(cards[i]) == 'heart') {
							cnt[3]++;
							if (get.value(cards[i]) <= 5)
								cntv[3]++;
						}
					}
					var num1 = 100;
					var num2 = 100;
					if (list.contains('club')) {
						if (num1 > cntv[0]) {
							num1 = cntv[0];
							num2 = cnt[0];
						}
						else if (num1 == cntv[0] && num2 > cnt[0]) {
							num1 = cntv[0];
							num2 = cnt[0];
						}

					}
					else if (list.contains('spade')) {
						if (num1 > cntv[1]) {
							num1 = cntv[1];
							num2 = cnt[1];
						}
						else if (num1 == cntv[1] && num2 > cnt[1]) {
							num1 = cntv[1];
							num2 = cnt[1];
						}
					}
					else if (list.contains('diamond')) {
						if (num1 > cntv[2]) {
							num1 = cntv[2];
							num2 = cnt[2];
						}
						else if (num1 == cntv[2] && num2 > cnt[2]) {
							num1 = cntv[2];
							num2 = cnt[2];
						}
					}
					else if (list.contains('heart')) {
						if (num1 > cntv[3]) {
							num1 = cntv[3];
							num2 = cnt[3];
						}
						else if (num1 == cntv[3] && num2 > cnt[3]) {
							num1 = cntv[3];
							num2 = cnt[3];
						}
					}
					if (num1 < 2) return true;
					return false;
				},
			},
			yaoqiang: {
				audio: 2,
				enable: 'phaseUse',
				usable: 1,
				filter: function (event, player) {
					return player.hasCard((card) => card.hasGaintag('feichu'), 'h');
				},
				filterTarget: function (card, player, target) {
					return player.canCompare(target);
				},
				content: function () {
					"step 0"
					player.chooseToCompare(target, null, function (card) {
						console.log(card);
						if (card.hasGaintag('feichu')) return true;
						return false;
					});
					"step 1"
					if (result.bool) {
						var list = ['复原此花色'];
						event.suit = get.suit(result.player);
						if (player.hasCard((card) => card.hasGaintag('feichu') && get.suit(card) == event.suit, 'h')) list.push('弃置该花色的所有手牌，获得X张不同的水母牌（X为弃置的手牌数且不大于4）');
						player.chooseControlList('请选择一项', list, true, function (event, player) {
							if (list.length == 1) return 0;
							var num1 = 0;
							var cards = player.getCards('h');
							for (var i = 0; i < cards.length; i++) {
								if (!cards[i].hasGaintag('feichu')) continue;
								if (get.suit(cards[i]) == event.suit && (player.getCardUsable(cards[i]) && get.value(cards[i]) > 5) || get.value(cards[i]) >= 7) {
									num1++;
								}
							}
							if (num1 >= 2) return 0;
							else return 1;
						});
					}
					else {
						event.finish();
					}
					'step 2'
					if (result.index == 0) {
						player.enableSuit(event.suit);
						event.finish();
					}
					else if (result.index == 1) {
						var cards = player.getCards('h');
						event.num = 0;
						var list = [];

						event.list = ['Shaixiu', 'Smingan', 'Skeai', 'Saojiao'];
						for (var i = 0; i < cards.length; i++) {
							if (!cards[i].hasGaintag('feichu')) continue;
							if (get.suit(cards[i]) == event.suit) {
								list.push(cards[i]);
								event.num++;
							}
						}
						event.num = Math.min(event.num, 4);
						player.discard(list);

						//向晚3
						event.num1 = event.num;
						player.checkChallenge(event, 'CLxiangwan3', 'character', 'onehun');
					}
					else {
						event.finish();
					}
					'step 3'
					player.chooseButton(['选择一张水母牌', [event.list, 'vcard']], true, function (button) {
						var players = game.filterPlayer();
						var num1 = 0.1;
						var num2 = 0.1;
						var num3 = 0.1;
						var num4 = 0.1;
						for (var i = 0; i < players.length; i++) {
							if (get.distance(player, players[i], 'attack') <= 1)
								num2 = Math.max(num2, -get.effect(players[i], { name: 'Smingan' }, player, players[i]));
							if (get.distance(player, players[i]) <= 1)
								num4 = Math.max(num4, -get.effect(players[i], { name: 'Saojiao' }, player, players[i]));
							var att = get.attitude(player, players[i]);
							if (att > 0 && players[i].hp == 1) {
								num3 += 25;
							}
						}
						if (player.getCardUsable('Smingan') == 0) num2 = 0.1;
						num1 += player.storage.disableSuit.length * 4;
						num3 += player.storage.disableSuit.length * 4;
						if (!player.hasCard((card) => card.name == 'shan' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
						if (!player.hasCard((card) => card.name == 'wuxie' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
						if (!player.hasCard((card) => card.name == 'tao' && !card.hasGaintag('feichu'), 'h')) num3 += 7;
						if (player.hp != player.maxHp) num3 += 12 * (player.maxHp - player.hp);
						console.log(num1, num2, num3, num4);
						if (button.name == 'Shaixiu') return num1;
						if (button.name == 'Smingan') return num2;
						if (button.name == 'Skeai') return num3;
						if (button.name == 'Saojiao') return num4;
					});
					'step 4'
					if (result.links[0][2] == 'Shaixiu') {
						var card = game.createCard('Shaixiu', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Smingan') {
						var card = game.createCard('Smingan', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Skeai') {
						var card = game.createCard('Skeai', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Saojiao') {
						var card = game.createCard('Saojiao', 'jellyfish');
						player.gain(card, 'draw');
					}
					game.log('#b' + get.translation(player), '获得了一张', '#y水母牌');
					event.list.remove(result.links[0][2]);
					'step 5'
					event.num--;
					if (event.num > 0)
						event.goto(3);
				},
				ai: {
					order: 12,
					result: {
						player: 3,
					},
					threaten: 1.5
				}
			},
			cainv: {
				audio: 2,
				forced: true,
				trigger: { player: 'compare', target: 'compare' },
				filter: function (event, player) {
					if (!player.storage.disableSuit) player.storage.disableSuit = [];
					if (event.iwhile) return false;
					return player.storage.disableSuit.length;
				},
				content: function () {
					game.log(player, '拼点牌点数', '#y+' + player.storage.disableSuit.length);
					if (player == trigger.player) {
						trigger.num1 += player.storage.disableSuit.length;
					}
					else {
						trigger.num2 += player.storage.disableSuit.length;
					}
				}
			},
			/*puge: {
				audio: 4,
				trigger: { player: 'phaseUseBegin' },
				filter: function (event, player) {
					if (!player.storage.puge) player.storage.puge = [];
					return player.storage.puge.length < 4;
				},
				content: function () {
					'step 0'
					var list = ['club', 'spade', 'diamond', 'heart'];
					for (var i = 0; i < player.storage.puge.length; i++)
						list.remove(player.storage.puge[i]);
					player.chooseControl(list, true).set('ai', function (event, player) {
						var cnt = [0, 0, 0, 0];
						var cntv = [0, 0, 0, 0];
						var list = ['club', 'spade', 'diamond', 'heart'];
						for (var i = 0; i < player.storage.puge.length; i++)
							list.remove(player.storage.puge[i]);
						var cards = player.getCards('h');
						for (var i = 0; i < cards.length; i++) {
							if (!list.contains(get.suit(cards[i]))) continue;
							if (get.suit(cards[i]) == 'club') {
								cnt[0]++;
								if (get.value(cards[i]) <= 5)
									cntv[0]++;
							}
							else if (get.suit(cards[i]) == 'spade') {
								cnt[1]++;
								if (get.value(cards[i]) <= 5)
									cntv[1]++;
							}
							else if (get.suit(cards[i]) == 'diamond') {
								cnt[2]++;
								if (get.value(cards[i]) <= 5)
									cntv[2]++;
							}
							else if (get.suit(cards[i]) == 'heart') {
								cnt[3]++;
								if (get.value(cards[i]) <= 5)
									cntv[3]++;
							}
						}
						var num1 = 500;
						var num2 = 500;
						var choose;
						if (list.contains('club')) {
							if (num1 > cntv[0]) {
								num1 = cntv[0];
								num2 = cnt[0];
								choose = 'club';
							}
							else if (num1 == cntv[0] && num2 > cnt[0]) {
								num1 = cntv[0];
								num2 = cnt[0];
								choose = 'club';
							}

						}
						if (list.contains('spade')) {
							if (num1 > cntv[1]) {
								num1 = cntv[1];
								num2 = cnt[1];
								choose = 'spade';
							}
							else if (num1 == cntv[1] && num2 > cnt[1]) {
								num1 = cntv[1];
								num2 = cnt[1];
								choose = 'spade';
							}
						}
						if (list.contains('diamond')) {
							if (num1 > cntv[2]) {
								num1 = cntv[2];
								num2 = cnt[2];
								choose = 'diamond';
							}
							else if (num1 == cntv[2] && num2 > cnt[2]) {
								num1 = cntv[2];
								num2 = cnt[2];
								choose = 'diamond';
							}
						}
						if (list.contains('heart')) {
							if (num1 > cntv[3]) {
								num1 = cntv[3];
								num2 = cnt[3];
								choose = 'heart';
							}
							else if (num1 == cntv[3] && num2 > cnt[3]) {
								num1 = cntv[3];
								num2 = cnt[3];
								choose = 'heart';
							}
						}
						console.log(num1, num2, choose);
						return choose;
					}).set('prompt', '废除一种花色');
					'step 1'
					if (result.control) {
						player.storage.puge.push(result.control);
						game.log('#b' + get.translation(player), '废除了', '#y' + result.control);
						player.markSkill('puge');
						var cards = player.getCards('h');
						for (var i = 0; i < cards.length; i++) {
							if (player.storage.puge.contains(get.suit(cards[i])))
								player.addGaintag(cards[i], 'feichu');
						}
						player.chooseButton(['选择一张水母牌', [['Shaixiu', 'Smingan', 'Skeai', 'Saojiao'], 'vcard']], true, function (button) {
							var players = game.filterPlayer();
							var num1 = 0.1;
							var num2 = 0.1;
							var num3 = 0.1;
							var num4 = 0.1;
							for (var i = 0; i < players.length; i++) {
								if (get.distance(player, players[i], 'attack') <= 1)
									num2 = Math.max(num2, -get.effect(players[i], { name: 'Smingan' }, player, players[i]));
								if (get.distance(player, players[i]) <= 1)
									num4 = Math.max(num4, -get.effect(players[i], { name: 'Saojiao' }, player, players[i]));
								var att = get.attitude(player, players[i]);
								if (att > 0 && players[i].hp == 1) {
									num3 += 25;
								}

							}
							if (player.getCardUsable('Smingan') == 0) num = 0.1;
							num1 += player.storage.puge.length * 4;
							num3 += player.storage.puge.length * 4;
							if (!player.hasCard((card) => card.name == 'shan' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
							if (!player.hasCard((card) => card.name == 'wuxie' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
							if (!player.hasCard((card) => card.name == 'tao' && !card.hasGaintag('feichu'), 'h')) num3 += 7;
							if (player.hp != player.maxHp) num3 += 12 * (player.maxHp - player.hp);
							console.log(num1, num2, num3, num4);
							if (button.name == 'Shaixiu') return num1;
							if (button.name == 'Smingan') return num2;
							if (button.name == 'Skeai') return num3;
							if (button.name == 'Saojiao') return num4;
						});
					}
					else {
						event.finish();
					}
					'step 2'
					if (result.links[0][2] == 'Shaixiu') {
						var card = game.createCard('Shaixiu', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Smingan') {
						var card = game.createCard('Smingan', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Skeai') {
						var card = game.createCard('Skeai', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Saojiao') {
						var card = game.createCard('Saojiao', 'jellyfish');
						player.gain(card, 'draw');
					}
					game.log('#b' + get.translation(player), '获得了一张', '#y水母牌');
				},
				check: function (event, player) {
					var cnt = [0, 0, 0, 0];
					var cntv = [0, 0, 0, 0];
					var list = ['club', 'spade', 'diamond', 'heart'];
					if (player.storage.puge.length > 2) return false;
					for (var i = 0; i < player.storage.puge.length; i++)
						list.remove(player.storage.puge[i]);
					var cards = player.getCards('h');
					for (var i = 0; i < cards.length; i++) {
						if (!list.contains(get.suit(cards[i]))) continue;
						if (get.suit(cards[i]) == 'club') {
							cnt[0]++;
							if (get.value(cards[i]) <= 5)
								cntv[0]++;
						}
						else if (get.suit(cards[i]) == 'spade') {
							cnt[1]++;
							if (get.value(cards[i]) <= 5)
								cntv[1]++;
						}
						else if (get.suit(cards[i]) == 'diamond') {
							cnt[2]++;
							if (get.value(cards[i]) <= 5)
								cntv[2]++;
						}
						else if (get.suit(cards[i]) == 'heart') {
							cnt[3]++;
							if (get.value(cards[i]) <= 5)
								cntv[3]++;
						}
					}
					var num1 = 100;
					var num2 = 100;
					if (list.contains('club')) {
						if (num1 > cntv[0]) {
							num1 = cntv[0];
							num2 = cnt[0];
						}
						else if (num1 == cntv[0] && num2 > cnt[0]) {
							num1 = cntv[0];
							num2 = cnt[0];
						}

					}
					if (list.contains('spade')) {
						if (num1 > cntv[1]) {
							num1 = cntv[1];
							num2 = cnt[1];
						}
						else if (num1 == cntv[1] && num2 > cnt[1]) {
							num1 = cntv[1];
							num2 = cnt[1];
						}
					}
					if (list.contains('diamond')) {
						if (num1 > cntv[2]) {
							num1 = cntv[2];
							num2 = cnt[2];
						}
						else if (num1 == cntv[2] && num2 > cnt[2]) {
							num1 = cntv[2];
							num2 = cnt[2];
						}
					}
					if (list.contains('heart')) {
						if (num1 > cntv[3]) {
							num1 = cntv[3];
							num2 = cnt[3];
						}
						else if (num1 == cntv[3] && num2 > cnt[3]) {
							num1 = cntv[3];
							num2 = cnt[3];
						}
					}
					if (num1 < 2) return true;
					if (num1 < 3 && num2 >= 2) return true;
					return false;
				},
				ai: {
					threaten: 1.8
				},
				group: ['puge2', 'puge3'],
				intro: {
					content: function (storage, player, skill) {
						if (player.storage.puge.length) {
							return '已废除花色：' + get.translation(player.storage.puge);
						}
					},
				},
			},
			puge2: {
				audio: 'puge',
				trigger: { player: 'damageEnd' },
				filter: function (event, player) {
					if (!player.storage.puge) player.storage.puge = [];
					return player.storage.puge.length < 4;
				},
				content: function () {
					'step 0'
					var list = ['club', 'spade', 'diamond', 'heart'];
					for (var i = 0; i < player.storage.puge.length; i++)
						list.remove(player.storage.puge[i]);
					player.chooseControl(list, true).set('ai', function (event, player) {
						var cnt = [0, 0, 0, 0];
						var cntv = [0, 0, 0, 0];
						var list = ['club', 'spade', 'diamond', 'heart'];
						for (var i = 0; i < player.storage.puge.length; i++)
							list.remove(player.storage.puge[i]);
						var cards = player.getCards('h');
						for (var i = 0; i < cards.length; i++) {
							if (!list.contains(get.suit(cards[i]))) continue;
							if (get.suit(cards[i]) == 'club') {
								cnt[0]++;
								if (get.value(cards[i]) <= 5)
									cntv[0]++;
							}
							else if (get.suit(cards[i]) == 'spade') {
								cnt[1]++;
								if (get.value(cards[i]) <= 5)
									cntv[1]++;
							}
							else if (get.suit(cards[i]) == 'diamond') {
								cnt[2]++;
								if (get.value(cards[i]) <= 5)
									cntv[2]++;
							}
							else if (get.suit(cards[i]) == 'heart') {
								cnt[3]++;
								if (get.value(cards[i]) <= 5)
									cntv[3]++;
							}
						}
						var num1 = 500;
						var num2 = 500;
						var choose;
						if (list.contains('club')) {
							if (num1 > cntv[0]) {
								num1 = cntv[0];
								num2 = cnt[0];
								choose = 'club';
							}
							else if (num1 == cntv[0] && num2 > cnt[0]) {
								num1 = cntv[0];
								num2 = cnt[0];
								choose = 'club';
							}

						}
						if (list.contains('spade')) {
							if (num1 > cntv[1]) {
								num1 = cntv[1];
								num2 = cnt[1];
								choose = 'spade';
							}
							else if (num1 == cntv[1] && num2 > cnt[1]) {
								num1 = cntv[1];
								num2 = cnt[1];
								choose = 'spade';
							}
						}
						if (list.contains('diamond')) {
							if (num1 > cntv[2]) {
								num1 = cntv[2];
								num2 = cnt[2];
								choose = 'diamond';
							}
							else if (num1 == cntv[2] && num2 > cnt[2]) {
								num1 = cntv[2];
								num2 = cnt[2];
								choose = 'diamond';
							}
						}
						if (list.contains('heart')) {
							if (num1 > cntv[3]) {
								num1 = cntv[3];
								num2 = cnt[3];
								choose = 'heart';
							}
							else if (num1 == cntv[3] && num2 > cnt[3]) {
								num1 = cntv[3];
								num2 = cnt[3];
								choose = 'heart';
							}
						}
						console.log(num1, num2, choose);
						return choose;
					}).set('prompt', '废除一种花色');
					'step 1'
					if (result.control) {
						player.storage.puge.push(result.control);
						game.log('#b' + get.translation(player), '废除了', '#y' + result.control);
						player.markSkill('puge');
						var cards = player.getCards('h');
						for (var i = 0; i < cards.length; i++) {
							if (player.storage.puge.contains(get.suit(cards[i])))
								player.addGaintag(cards[i], 'feichu');
						}
						player.chooseButton(['选择一张水母牌', [['Shaixiu', 'Smingan', 'Skeai', 'Saojiao'], 'vcard']], true, function (button) {
							var players = game.filterPlayer();
							var num1 = 0.1;
							var num3 = 0.1;
							num1 += player.storage.puge.length * 4;
							num3 += player.storage.puge.length * 3;
							if (!player.hasCard((card) => card.name == 'shan' && !card.hasGaintag('feichu'), 'h')) num1 += 8;
							if (!player.hasCard((card) => card.name == 'wuxie' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
							if (!player.hasCard((card) => card.name == 'tao' && !card.hasGaintag('feichu'), 'h')) num3 += 7;
							if (player.hp != player.maxHp) num3 += 7 * (player.maxHp - player.hp);
							console.log(num1, num3);
							if (button.name == 'Shaixiu') return num1;
							if (button.name == 'Smingan') return false;
							if (button.name == 'Skeai') return num3;
							if (button.name == 'Saojiao') return false;
						});
					}
					else {
						event.finish();
					}
					'step 2'
					if (result.links[0][2] == 'Shaixiu') {
						var card = game.createCard('Shaixiu', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Smingan') {
						var card = game.createCard('Smingan', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Skeai') {
						var card = game.createCard('Skeai', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Saojiao') {
						var card = game.createCard('Saojiao', 'jellyfish');
						player.gain(card, 'draw');
					}
					game.log('#b' + get.translation(player), '获得了一张', '#y水母牌');
				},
				check: function (event, player) {
					var cnt = [0, 0, 0, 0];
					var cntv = [0, 0, 0, 0];
					var list = ['club', 'spade', 'diamond', 'heart'];
					if (player.storage.puge.length > 2) return false;
					for (var i = 0; i < player.storage.puge.length; i++)
						list.remove(player.storage.puge[i]);
					var cards = player.getCards('h');
					for (var i = 0; i < cards.length; i++) {
						if (!list.contains(get.suit(cards[i]))) continue;
						if (get.suit(cards[i]) == 'club') {
							cnt[0]++;
							if (get.value(cards[i]) <= 5)
								cntv[0]++;
						}
						if (get.suit(cards[i]) == 'spade') {
							cnt[1]++;
							if (get.value(cards[i]) <= 5)
								cntv[1]++;
						}
						if (get.suit(cards[i]) == 'diamond') {
							cnt[2]++;
							if (get.value(cards[i]) <= 5)
								cntv[2]++;
						}
						if (get.suit(cards[i]) == 'heart') {
							cnt[3]++;
							if (get.value(cards[i]) <= 5)
								cntv[3]++;
						}
					}
					var num1 = 100;
					var num2 = 100;
					if (list.contains('club')) {
						if (num1 > cntv[0]) {
							num1 = cntv[0];
							num2 = cnt[0];
						}
						else if (num1 == cntv[0] && num2 > cnt[0]) {
							num1 = cntv[0];
							num2 = cnt[0];
						}

					}
					else if (list.contains('spade')) {
						if (num1 > cntv[1]) {
							num1 = cntv[1];
							num2 = cnt[1];
						}
						else if (num1 == cntv[1] && num2 > cnt[1]) {
							num1 = cntv[1];
							num2 = cnt[1];
						}
					}
					else if (list.contains('diamond')) {
						if (num1 > cntv[2]) {
							num1 = cntv[2];
							num2 = cnt[2];
						}
						else if (num1 == cntv[2] && num2 > cnt[2]) {
							num1 = cntv[2];
							num2 = cnt[2];
						}
					}
					else if (list.contains('heart')) {
						if (num1 > cntv[3]) {
							num1 = cntv[3];
							num2 = cnt[3];
						}
						else if (num1 == cntv[3] && num2 > cnt[3]) {
							num1 = cntv[3];
							num2 = cnt[3];
						}
					}
					if (num1 < 2) return true;
					return false;
				},
			},
			puge3: {
				direct: true,
				trigger: { player: 'gainAfter' },
				content: function () {
					if (!player.storage.puge) player.storage.puge = [];
					for (var i = 0; i < trigger.cards.length; i++) {
						if (player.storage.puge.contains(get.suit(trigger.cards[i])))
							player.addGaintag(trigger.cards[i], 'feichu');
					}
				},
				mod: {
					cardEnabled: function (card, player) {
						if (!player.storage.puge)
							player.storage.puge = [];
						if (player.storage.puge.contains(get.suit(card))) return false;
					},
					cardEnabled2: function (card, player) {
						if (!player.storage.puge)
							player.storage.puge = [];
						if (player.storage.puge.contains(get.suit(card))) return false;
					},
					cardUsable: function (card, player) {
						if (!player.storage.puge)
							player.storage.puge = [];
						if (player.storage.puge.contains(get.suit(card))) return false;
					},
					ignoredHandcard: function (card, player) {
						if (!player.storage.puge)
							player.storage.puge = [];
						if (player.storage.puge.contains(get.suit(card))) return true;
					},
					cardDiscardable: function (card, player, name) {
						if (!player.storage.puge)
							player.storage.puge = [];
						if (name == 'phaseDiscard' && player.storage.puge.contains(get.suit(card))) return false;
					},
				},
				onremove: function (player) {
					player.removeGaintag('feichu');
				},
			},
			yaoqiang: {
				audio: 2,
				enable: 'phaseUse',
				usable: 1,
				filter: function (event, player) {
					return player.hasCard((card) => card.hasGaintag('feichu'), 'h');
				},
				filterTarget: function (card, player, target) {
					return player.canCompare(target);
				},
				content: function () {
					"step 0"
					player.chooseToCompare(target, null, function (card) {
						if (card.hasGaintag('feichu')) return true;
						return false;
					});
					"step 1"
					if (result.bool) {
						var list = ['复原此花色'];
						event.suit = get.suit(result.player);
						if (player.hasCard((card) => card.hasGaintag('feichu') && get.suit(card) == event.suit, 'h')) list.push('弃置该花色的所有手牌，获得X张不同的水母牌（X为弃置的手牌数且不大于4）');
						player.chooseControlList('请选择一项', list, true, function (event, player) {
							if (list.length == 1) return 0;
							var num1 = 0;
							var cards = player.getCards('h');
							for (var i = 0; i < cards.length; i++) {
								if (!cards[i].hasGaintag('feichu')) continue;
								if (get.suit(cards[i]) == event.suit && (player.getCardUsable(cards[i]) && get.value(cards[i]) > 5) || get.value(cards[i]) >= 7) {
									num1++;
								}
							}
							if (num1 >= 2) return 0;
							else return 1;
						});
					}
					else {
						event.finish();
					}
					'step 2'
					if (result.index == 0) {
						player.storage.puge.remove(event.suit);
						var cards = player.getCards('h');
						var lists = [];
						for (var i = 0; i < cards.length; i++) {
							if (!cards[i].hasGaintag('feichu')) continue;
							if (get.suit(cards[i]) == event.suit) lists.push(cards[i]);
						}
						player.removeGaintag('feichu', lists);
						game.log('#b' + get.translation(player), '恢复了', '#y' + event.suit);
						if (!player.storage.puge.length) player.unmarkSkill('puge');
						event.finish();
					}
					else if (result.index == 1) {
						var cards = player.getCards('h');
						event.num = 0;
						var list = [];

						event.list = ['Shaixiu', 'Smingan', 'Skeai', 'Saojiao'];
						for (var i = 0; i < cards.length; i++) {
							if (!cards[i].hasGaintag('feichu')) continue;
							if (get.suit(cards[i]) == event.suit) {
								list.push(cards[i]);
								event.num++;
							}
						}
						event.num = Math.min(event.num, 4);
						player.discard(list);

						//向晚3
						event.num1 = event.num;
						player.checkChallenge(event, 'CLxiangwan3', 'character', 'onehun');
					}
					else {
						event.finish();
					}
					'step 3'
					player.chooseButton(['选择一张水母牌', [event.list, 'vcard']], true, function (button) {
						var players = game.filterPlayer();
						var num1 = 0.1;
						var num2 = 0.1;
						var num3 = 0.1;
						var num4 = 0.1;
						for (var i = 0; i < players.length; i++) {
							if (get.distance(player, players[i], 'attack') <= 1)
								num2 = Math.max(num2, -get.effect(players[i], { name: 'Smingan' }, player, players[i]));
							if (get.distance(player, players[i]) <= 1)
								num4 = Math.max(num4, -get.effect(players[i], { name: 'Saojiao' }, player, players[i]));
							var att = get.attitude(player, players[i]);
							if (att > 0 && players[i].hp == 1) {
								num3 += 25;
							}
						}
						if (player.getCardUsable('Smingan') == 0) num2 = 0.1;
						num1 += player.storage.puge.length * 4;
						num3 += player.storage.puge.length * 4;
						if (!player.hasCard((card) => card.name == 'shan' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
						if (!player.hasCard((card) => card.name == 'wuxie' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
						if (!player.hasCard((card) => card.name == 'tao' && !card.hasGaintag('feichu'), 'h')) num3 += 7;
						if (player.hp != player.maxHp) num3 += 12 * (player.maxHp - player.hp);
						console.log(num1, num2, num3, num4);
						if (button.name == 'Shaixiu') return num1;
						if (button.name == 'Smingan') return num2;
						if (button.name == 'Skeai') return num3;
						if (button.name == 'Saojiao') return num4;
					});
					'step 4'
					if (result.links[0][2] == 'Shaixiu') {
						var card = game.createCard('Shaixiu', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Smingan') {
						var card = game.createCard('Smingan', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Skeai') {
						var card = game.createCard('Skeai', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Saojiao') {
						var card = game.createCard('Saojiao', 'jellyfish');
						player.gain(card, 'draw');
					}
					game.log('#b' + get.translation(player), '获得了一张', '#y水母牌');
					event.list.remove(result.links[0][2]);
					'step 5'
					event.num--;
					if (event.num > 0)
						event.goto(3);
				},
				ai: {
					order: 12,
					result: {
						player: 3,
					},
					threaten: 1.5
				}
			},
			cainv: {
				audio: 2,
				forced: true,
				trigger: { player: 'compare', target: 'compare' },
				filter: function (event, player) {
					if (!player.storage.puge) player.storage.puge = [];
					if (event.iwhile) return false;
					return player.storage.puge.length;
				},
				content: function () {
					game.log(player, '拼点牌点数', '#y+' + player.storage.puge.length);
					if (player == trigger.player) {
						trigger.num1 += player.storage.puge.length;
					}
					else {
						trigger.num2 += player.storage.puge.length;
					}
				}
			},*/

			_shuimu_destroy: {
				trigger: { global: ['loseEnd', 'cardsDiscardEnd'] },
				forced: true,
				charlotte: true,
				filter: function (event, player) {
					var cs = event.cards;
					for (var i = 0; i < cs.length; i++) {
						if (cs[i].name.indexOf('S') == 0 && get.position(cs[i], true) == 'd') return true;
					}
					return false;
				},
				forceDie: true,
				content: function () {
					if (!_status.fumian) _status.fumian = {};
					var list = [];
					var cs = trigger.cards;
					for (var i = 0; i < cs.length; i++) {
						if (cs[i].name.indexOf('S') == 0 && get.position(cs[i], true) == 'd') {
							_status.fumian[cs[i].name] = false;
							list.push(cs[i]);
						}
					}
					game.cardsGotoSpecial(list);
				},
			},
			_Shaixiu: {
				trigger: { global: 'useCard2' },
				priority: 7,
				popup: false,
				forced: true,
				filter: function (event, player) {
					if (event.player != player && event.targets && event.targets.contains(player) && get.type(event.card) != 'delay' && player.countCards('h', { name: 'Shaixiu' })) return true;
					return false;
				},
				content: function () {
					'step 0'
					target = trigger.player;
					var card = trigger.card;
					var str = '';
					str += get.translation(target) + '的';
					str += get.translation(card);
					str += '将生效，是否使用【害羞小水母】？';
					player.chooseCard('h', str, function (card) {
						return get.name(card) == 'Shaixiu';
					}).set('ai', function (card) {
						var target=_status.event.getParent().getTrigger().player;
						var eff = get.effect(_status.event.player, trigger.card, target, _status.event.player);
						if (eff >= 0) return 0;
						return 1;
					});
					'step 1'
					if (result.bool) {
						game.playAudio('card', player.sex, 'Shaixiu');
						player.discard(result.cards[0]);
						player.draw();
						trigger.cancel();
						game.log('#b' + get.translation(player), '取消了', '#y' + get.translation(trigger.card), '的效果');
						event.finish();
					}
				},
			},

			jiejie: {
				forced: true,
				audio: 2,
				group:'jiejie2',
				trigger: { player: 'phaseBegin' },
				content: function () {
					var list = ['JJfengmo', 'JJsaiqian', 'JJerchong', 'JJfengyin'];
					var num = Math.floor(Math.random() * 4);
					//	var num=3;
					player.addTempSkill(list[num], { player: 'phaseBeginStart' });
				},
				ai: {
					threaten: 2,
				},
			},
			jiejie2:{
				forced:true,
				audio:2,
				trigger:{global:'phaseEnd'},
				filter:function(event,player){
					return player.hasMark('ranyou');
				},
				content:function(){
					var num=player.countMark('ranyou');
					player.removeMark('ranyou',num);
					player.draw(num);
				}
			},
			JJfengmo: {
				audio: 2,
				filter: function (event, player) {
					return player.countCards('hes', { type: 'equip' }) > 0;
				},
				logTarget: 'target',
				enable: 'phaseUse',
				usable: 1,
				filterCard: function (card) {
					return get.type(card) == 'equip';
				},
				filterTarget: function (card, player, target) {
					return target.storage.disableEquip != undefined && target.storage.disableEquip.length < 5 && player != target;
				},
				content: function () {
					'step 0'
					if (target.storage.disableEquip != undefined && target.storage.disableEquip.length < 5) {
						var list = ['equip1', 'equip2', 'equip6', 'equip5'];
						for (var i = 0; i < target.storage.disableEquip.length; i++) {
							if (target.storage.disableEquip[i] == 'equip3' || target.storage.disableEquip[i] == 'equip4')
								list.remove('equip6');
							list.remove(target.storage.disableEquip[i]);
						}
						player.chooseControl(list, true).set('ai', function (event, player) {
							var cards = target.getCards('e');
							var num = 0;
							var card;
							for (var i = 0; i < cards.length; i++) {
								if (num < get.value(cards[i])) {
									num = get.value(cards[i]);
									card = cards[i];
								}
							}
							if (!card) {
								if (list.contains('equip1')) return 'equip1';
								if (list.contains('equip2')) return 'equip2';
								if (list.contains('equip6')) return 'equip6';
								if (list.contains('equip5')) return 'equip5';
							}
							if (get.subtype(card) == 'equip3' || get.subtype(card) == 'equip4')
								return 'equip6';
							return get.subtype(card);
						});
					}
					else {
						event.finish();
					}
					'step 1'
					if (result.control) {
						if (result.control == 'equip6') {
							target.disableEquip('equip3');
							target.disableEquip('equip4');
						}
						else
							target.disableEquip(result.control);
					}
				},
				position: 'hes',
				prompt: '弃置一张装备牌，然后废除其他角色一个装备栏',
				check: function (card) { return 10 - get.value(card) },
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							var cards = target.getCards('e');
							var num = 0;
							for (var i = 0; i < cards.length; i++) {
								var num = Math.max(get.value(cards[i]), num);
							}
							return -num - 0.1;
						}
					},
					threaten: 1.8
				}
			},
			JJsaiqian: {
				audio: 2,
				discard: false,
				lose: false,
				delay: 0,
				logTarget: 'target',
				enable: 'phaseUse',
				usable: 1,
				filterTarget: function (card, player, target) {
					return player != target;
				},
				content: function () {
					'step 0'
					target.chooseCard('hes', '【塞钱】：请交给' + get.translation(target) + '一张牌，否则受到1点自适应伤害').set('ai', function (card) {
						return 7 - get.value(card);
					});
					'step 1'
					if (!result.bool) {
						target.autoDamage(1);
					}
					else {
						player.gain(result.cards, target, 'give');
					}
				},
				prompt: '令一名其他角色交给你一张牌，否则其受到1点自适应伤害',
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							var cards = target.getCards('h');
							for (var i = 0; i < cards.length; i++)
								if (cards[i].name == 'du')
									return 2;
							return -1.5;
						},
					},
					threaten: 2
				}
			},
			JJerchong: {
				audio: 2,
				trigger: { global: 'phaseJudgeAfter' },
				filter: function (event, player) {
					if (event.player == player) return false;
					return true;
				},
				direct: true,
				content: function () {
					"step 0"
					player.chooseBool(get.prompt("JJerchong"), "是否与" + get.translation(trigger.player) + "交换摸牌和出牌阶段").set('ai', function () {
						att = get.attitude(player, event.player);
						if (att >= 0) return false;
						return Math.random() >= 0.5 ? true : false;
					});
					"step 1"
					if (result.bool) {
						console.log(trigger.player, player, 'asddd');
						player.logSkill('JJerchong');
						game.log('#b' + get.translation(player), '进行二重大结界赋予的摸牌和出牌阶段');
						trigger.player.skip('phaseDraw');
						trigger.player.skip('phaseUse');
						var next1 = player.phaseDraw();
						var next2 = player.phaseUse();
						trigger.next.push(next1);
						trigger.next.push(next2);
						player.addTempSkill('JJerchong2', { player: 'phaseEndStart' });
						player.storage.JJerchong2 = trigger.player;
						player.removeSkill('JJerchong');
						trigger.player.markSkill('JJerchong2');
					}
				},
			},
			JJerchong2: {
				audio: 2,
				trigger: { player: 'phaseJudgeAfter' },
				direct: true,
				content: function () {
					player.logSkill('JJerchong');
					player.skip('phaseDraw');
					player.skip('phaseUse');
					game.log('#b' + get.translation(player.storage.JJerchong2), '进行交换的摸牌和出牌阶段');
					var next1 = player.storage.JJerchong2.phaseDraw();
					var next2 = player.storage.JJerchong2.phaseUse();
					player.storage.JJerchong2.unmarkSkill('JJerchong2');
					trigger.next.push(next1);
					trigger.next.push(next2);
					delete player.storage.JJerchong2;
				},
			//	marktext: "二",
				markimage:'image/mark/fuka.png',
				intro: {
					name: "二重",
					content: function (storage, player, skill) {
						return "博丽灵然与你交换了摸牌和出牌阶段";
					},
				},
			},
			JJfengyin: {
				audio: 1,
				locked: true,
				trigger: { player: 'phaseJieshuBegin' },
				forced: true,
				content: function () {
					'step 0'
					cards = get.cards(3);
					player.showCards(cards);
					game.cardsGotoOrdering(cards);
					event.list = [];
					for (var i = 0; i < cards.length; i++) {
						if (!event.list.contains(get.suit(cards[i])))
							event.list.push(get.suit(cards[i]));
					}
					event.cnt = 0;
					'step 1'
					player.chooseUseTarget({ name: 'sha' });
					'step 2'
					if (result.bool) {
						event.cnt++;
						if (event.cnt < event.list.length)
							event.goto(1);
					}
				},
			},

			zhaowan: {
				enable: 'phaseUse',
				usable: 1,
				content: function () {
					'step 0'
					player.chooseToFind({
						//歌曲名称
						name: '向晚',
						picturename: 'image/mode/tiaozhan/find_xiangwan.png',
						filename: 'avavava',
						filename2: 'aaaaaaa',
					});
					'step 1'
					event.score = result.rank[0];
					game.log(player, '的评级为', '#y' + result.rank[0], '，其在', '#y' + result.time, '秒内找到了目标');
					if (event.score == 'SS' || event.score == 'S') event.num = 3;
					else if (event.score == 'A') event.num = 2;
					else if (event.score == 'B') event.num = 1;
					else {
						event.finish();
					}
					event.list = ['Shaixiu', 'Smingan', 'Skeai', 'Saojiao'];
					'step 2'
					player.chooseButton(['选择一张水母牌', [event.list, 'vcard']], true, function (button) {
						var players = game.filterPlayer();
						var num1 = 0.1;
						var num2 = 0.1;
						var num3 = 0.1;
						var num4 = 0.1;
						for (var i = 0; i < players.length; i++) {
							if (get.distance(player, players[i], 'attack') <= 1)
								num2 = Math.max(num2, -get.effect(players[i], { name: 'Smingan' }, player, players[i]));
							if (get.distance(player, players[i]) <= 1)
								num4 = Math.max(num4, -get.effect(players[i], { name: 'Saojiao' }, player, players[i]));
							var att = get.attitude(player, players[i]);
							if (att > 0 && players[i].hp == 1) {
								num3 += 25;
							}
						}
						if (player.getCardUsable('Smingan') == 0) num2 = 0.1;
						if (!player.hasCard((card) => card.name == 'shan' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
						if (!player.hasCard((card) => card.name == 'wuxie' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
						if (!player.hasCard((card) => card.name == 'tao' && !card.hasGaintag('feichu'), 'h')) num3 += 7;
						if (player.hp != player.maxHp) num3 += 12 * (player.maxHp - player.hp);
						if (button.name == 'Shaixiu') return num1;
						if (button.name == 'Smingan') return num2;
						if (button.name == 'Skeai') return num3;
						if (button.name == 'Saojiao') return num4;
					});
					'step 3'
					if (result.links[0][2] == 'Shaixiu') {
						var card = game.createCard('Shaixiu', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Smingan') {
						var card = game.createCard('Smingan', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Skeai') {
						var card = game.createCard('Skeai', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Saojiao') {
						var card = game.createCard('Saojiao', 'jellyfish');
						player.gain(card, 'draw');
					}
					game.log('#b' + get.translation(player), '获得了一张', '#y水母牌');
					event.list.remove(result.links[0][2]);
					'step 4'
					event.num--;
					if (event.num > 0)
						event.goto(2);
				},
				ai: {
					order: 10,
					result: {
						player: 1,
					},
				},
			},
			maoyu: {
				forced: true,
				audio: 2,
				group: ['maoyu2'],
				trigger: { player: ['phaseDiscardBegin'] },
				filter: function (event, player) {
					return player.countCards('h', function (card) {
						return get.isShuimu(card);
					});
				},
				content: function () {
					trigger.audioed = true;
				},
				mod: {
					maxHandcardBase: function (player, num) {
						if (player.countCards('h', function (card) {
							return get.isShuimu(card);
						})) return num - 1;
					}
				}
			},
			maoyu2: {
				forced: true,
				audio: 2,
				trigger: { global: 'loseAfter' },
				filter: function (event, player) {
					if (event.type != 'discard') return false;
					for (var i = 0; i < event.cards2.length; i++) {
						if (get.isShuimu(event.cards2[i]) && get.position(event.cards2[i], true) == 's') {
							return true;
						}
					}
					return false;
				},
				content: function () {
					'step 0'
					var list = ['摸一张牌', '卜算两张牌'];
					player.chooseControlList(get.prompt('maoyu'), list, function (event, player) {
						if (player.hp == 1 || player.countCards('h') < player.hp) return 0;
						return 1;
					});
					'step 1'
					if (result.index == 0) {
						player.draw();
					}
					else if (result.index == 1) {
						player.chooseToGuanxing(2);
					}
				},
			},

			zhuliu: {
				locked: true,
				audio: 2,
				trigger: { player: 'useCardToPlayered' },
				logTarget: 'target',
				global: 'zhuliu2',
				filter: function (event, player) {
					if (event.card.name != 'sha' || event.card.storage == 'delay_jiabu' || event.card.storage == 'delay_zhifang' || event.card.storage == 'delay_xiayu' || event.card.storage == 'delay_fengqing' || event.card.storage == 'delay_luanchuang') return false;
					return true;
				},
				content: function () {
					trigger.card.storage = 'delay_xiayu';
				},
				forced: true,
				preHidden: true,
				ai: {
					threaten: 1.5,
				}
			},
			zhuliu2: {
				audio: 2,
				mod: {
					suit: function (card, suit, player) {
						if (!_status.currentPhaseUse) return;
						if (!_status.currentPhase.hasSkill('zhuliu')) return;
						if (_status.currentPhaseUse.isAlive() && _status.currentPhaseUse.hasSkill('zhuliu')) {
							return 'jellyfish';
						}
					},
				},
			},
			xueyan: {
				audio: 2,
				enable: 'phaseUse',
				usable: 1,
				filter: function (event, player) {
					if (player.countCards('h') == 0) return false;
					return game.hasPlayer(function (current) {
						return current.canAddJudge({ name: 'sha_delay' }) && current.countCards('h');
					});
				},
				filterTarget: function (card, player, target) {
					return target.canAddJudge({ name: 'sha_delay' }) && player.canCompare(target);
				},
				content: function () {
					"step 0"
					player.chooseToCompare(target, function (card) {
						if (typeof card == 'string' && lib.skill[card]) {
							var ais = lib.skill[card].check || function () { return 0 };
							return ais();
						}
						var player = get.owner(card);
						var getn = function (card) {
							if (player.hasSkill('tianbian') && get.suit(card) == 'heart') return 13;
							return get.number(card);
						}
						var event = _status.event.getParent();
						var to = (player == event.player ? event.target : event.player);
						var addi = (get.value(card) >= 8 && get.type(card) != 'equip') ? -10 : 0;
						if (card.name == 'du') addi -= 5;
						event.small = true;
						if (player == event.player) {
							if (get.attitude(player, to) > 0 && event.small) {
								return -getn(card) - get.value(card) / 2 + addi;
							}
							return getn(card) - get.value(card) / 2 + addi;
						}
						else {
							if (get.attitude(player, to) > 0 && !event.small) {
								return -getn(card) - get.value(card) / 2 + addi;
							}
							return getn(card) - get.value(card) / 2 + addi;
						}
					});
					"step 1"
					if (result.bool) {
						target.addJudge({ name: 'sha_delay' }, [result.player], player);
					}
					else {
						target.recover();
					}
				},
				ai: {
					order: 0.5,
					result: {
						target: function (player, target) {
							if (target.hp == target.maxHp) return -1;
							var cards = player.getCards('h');
							var num1 = 0, num2 = 0;
							for (var i = 0; i < cards.length; i++) {
								num1 = Math.max(cards[i].number, num1);
								num2 = Math.min(cards[i].number, num2);
							}
							if (get.attitude(player, target) < 0) return (Math.ceil(Math.random() * 13) + 1) < num2 ? -1 : 1;
							else return (Math.ceil(Math.random() * 13) + 1) > num2 ? 1 : -1;
						},
					},
				}
			},
			luanbei: {
				trigger: {
					player: 'phaseJieshuBegin',
				},
				audio: 2,
				group: ['luanbei2', 'luanbei3'],
				frequent: true,
				filter: function (event, player) {
					console.log(player, player.storage.luanbei);
					if (player.storage.luanbei && player.storage.luanbei.length >= 3) {
						return true;
					}
					else {
						return false;
					}
				},
				content: function () {
					'step 0'
					var cards = player.getCards('h');
					player.chooseButton(['选择一张水母牌', [['Shaixiu', 'Smingan', 'Skeai', 'Saojiao'], 'vcard']], true, function (button) {
						var players = game.filterPlayer();
						var num1 = 0.1;
						var num2 = 0.1;
						var num3 = 0.1;
						var num4 = 0.1;
						for (var i = 0; i < players.length; i++) {
							if (get.distance(player, players[i], 'attack') <= 1)
								num2 = Math.max(num2, -get.effect(players[i], { name: 'Smingan' }, player, players[i]));
							if (get.distance(player, players[i]) <= 1)
								num4 = Math.max(num4, -get.effect(players[i], { name: 'Saojiao' }, player, players[i]));
							var att = get.attitude(player, players[i]);
							if (att > 0 && players[i].hp == 1) {
								num3 += 25;
							}

						}
						if (player.getCardUsable('Smingan') == 0) num = 0.1;
						if (!player.hasCard((card) => card.name == 'shan' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
						if (!player.hasCard((card) => card.name == 'wuxie' && !card.hasGaintag('feichu'), 'h')) num1 += 7;
						if (!player.hasCard((card) => card.name == 'tao' && !card.hasGaintag('feichu'), 'h')) num3 += 7;
						if (player.hp != player.maxHp) num3 += 12 * (player.maxHp - player.hp);
						console.log(num1, num2, num3, num4);
						if (button.name == 'Shaixiu') return num1;
						if (button.name == 'Smingan') return num2;
						if (button.name == 'Skeai') return num3;
						if (button.name == 'Saojiao') return num4;
					});
					'step 1'
					if (result.links[0][2] == 'Shaixiu') {
						var card = game.createCard('Shaixiu', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Smingan') {
						var card = game.createCard('Smingan', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Skeai') {
						var card = game.createCard('Skeai', 'jellyfish');
						player.gain(card, 'draw');
					}
					else if (result.links[0][2] == 'Saojiao') {
						var card = game.createCard('Saojiao', 'jellyfish');
						player.gain(card, 'draw');
					}
					game.log('#b' + get.translation(player), '获得了一张', '#y水母牌');
				},
			},
			luanbei2: {
				popup: false,
				forced: true,
				trigger: {
					global: ['useCardAfter', 'judgeAfter', 'chooseToCompareAfter'],
				},
				frequent: true,
				filter: function (event, player) {
					if (_status.currentPhase != player) return false;
					if (event.name == 'chooseToCompare') return get.suit(event.card1, player) == 'jellyfish' || get.suit(event.card2, player) == 'jellyfish';
					else if (event.name == 'useCard') return get.suit(event.card, player) == 'jellyfish';
					else return get.suit(event.result.card, player) == 'jellyfish';

				},
				content: function () {
					if (trigger.name.indexOf('_delay') != -1) {
						event.finish();
					}
					else {
						if (!player.storage.luanbei) player.storage.luanbei = [];
						if (trigger.name == 'chooseToCompare') {
							if (trigger.card1 && get.suit(trigger.card1, player) == 'jellyfish' && !player.storage.luanbei.contains(get.type(trigger.card1, 'trick'))) player.storage.luanbei.push(get.type(trigger.card1, 'trick'));
							if (trigger.card2 && get.suit(trigger.card2, player) == 'jellyfish' && !player.storage.luanbei.contains(get.type(trigger.card2, 'trick'))) player.storage.luanbei.push(get.type(trigger.card2, 'trick'));
						}
						else if (trigger.name == 'useCard' && trigger.card && get.suit(trigger.card, player) == 'jellyfish' && !player.storage.luanbei.contains(get.type(trigger.card, 'trick'))) player.storage.luanbei.push(get.type(trigger.card, 'trick'));
						else if (trigger.name == 'judge' && trigger.result.card && get.suit(trigger.result.card, player) == 'jellyfish' && !player.storage.luanbei.contains(get.type(trigger.result.card, 'trick'))) player.storage.luanbei.push(get.type(trigger.result.card, 'trick'));
						console.log(trigger.name, player.storage.luanbei);
					}

				},
			},
			luanbei3: {
				trigger: {
					player: 'phaseJieshuEnd',
				},
				popup: false,
				forced: true,
				content: function () {
					player.storage.luanbei = [];
				},
			},

			zhengbei: {
				global: 'zhengbei2',
				audio: 'zhengbei2',
			},
			zhengbei2: {
				popup: false,
				enable: 'phaseUse',
				filter: function (event, player) {
					if (player.hasSkill('zhengbei')) return false;
					return player.countCards('h', { type: 'equip' }) > 0 && game.hasPlayer(function (current) {
						if (current.isMin()) return false;
						var cards = player.getCards('h', { type: 'equip' });
						var yes = false;
						for (var i = 0; i < cards.length; i++)
							if (current.isEmpty(get.subtype(cards[i]))) yes = true;
						return player != current && yes && current.hasSkill('zhengbei');
					});
				},
				filterCard: function (card) {
					return get.type(card) == 'equip' && game.hasPlayer(function (current) {
						if (current.isMin()) return false;
						var type = get.subtype(card);
						return current.isEmpty(type) && current.hasSkill('zhengbei');
					});
				},
				check: function (card) {
					var player = _status.currentPhase;
					if (player.countCards('he', { subtype: get.subtype(card) }) > 1) {
						return 11 - get.equipValue(card);
					}
					return 6 - get.value(card);
				},
				filterTarget: function (card, player, target) {
					if (target.isMin()) return false;
					var type = get.subtype(card);
					return player != target && target.isEmpty(type) && target.hasSkill('zhengbei');
				},
				content: function () {
					if (get.subtype(cards[0]) == 'equip1') player.logSkill('zhengbei2_equip1');
					else if (get.subtype(cards[0]) == 'equip2') player.logSkill('zhengbei2_equip2');
					else if (get.subtype(cards[0]) == 'equip3' || get.subtype(cards[0]) == 'equip4') player.logSkill('zhengbei2_equip3');
					else if (get.subtype(cards[0]) == 'equip5') player.logSkill('zhengbei2_equip4');
					target.equip(cards[0]);
					player.draw();
				},
				discard: false,
				prepare: function (cards, player, targets) {
					player.$give(cards, targets[0], false);
				},
				subSkill: {
					equip1: {
						audio: 1,
						content: {},
					},
					equip2: {
						audio: 1,
						content: {},
					},
					equip3: {
						audio: 1,
						content: {},
					},
					equip4: {
						audio: 1,
						content: {},
					},
				},
				ai: {
					basic: {
						order: 10
					},
					result: {
						target: function (player, target) {
							var card = ui.selected.cards[0];
							if(!card) return 0;
							var friend1=game.hasPlayer(function(current){
								return current.storage.lijia_mark&&current.storage.lijia_mark.contains(target)&&get.attitude(player,current)>0;
							});
							var enemy1=game.hasPlayer(function(current){
								return current.storage.lijia_mark&&current.storage.lijia_mark.contains(target)&&get.attitude(player,current)<0;
							});
							var num=get.effect(target, card, target,target);
							if(friend1) num+=1;
							if(enemy1) num-=1;
							if (card) return num+0.1;
							return 0;
						},
					},
				}
			},
			lijia: {
				audio: 2,
				trigger: {
					player: "phaseJieshuBegin",
				},
				direct: true,
				content: function () {
					"step 0"
					player.chooseTarget(get.prompt2('lijia'), function (card, player, target) {
						return target != player;
					}).set('ai', function (target) {
						var player = _status.event.player;
						var num = player.countCards('e') - target.countCards('h');
						var att = get.attitude(player, target);
						return num * att;
					});
					"step 1"
					if (result.bool) {
						var target = result.targets[0];
						player.logSkill('lijia', target);
						player.addSkill("lijia2");
						target.addSkill("lijia_mark");
						target.storage.lijia_mark.push(player);
						target.markSkill("lijia_mark");
					}
				},
				sync: function (player, target) {
					var num = player.countCards('e');
					var num2 = target.countCards('h');
					if (num < num2) {
						player.logSkill('lijia_discard');
						target.chooseToDiscard(num2 - num, true, 'h');
					}
					else {
						player.logSkill('lijia_draw');
						target.drawTo(num);
					}
				},
				subSkill: {
					draw: {
						audio: 1,
						content: {},
					},
					discard: {
						audio: 1,
						content: {},
					},
				},
			},
			lijia2: {
				trigger: {
					global: "phaseEnd",
				},
				popup: false,
				forced: true,
				charlotte: true,
				logTarget: "player",
				filter: function (event, player) {
					return event.player.storage.lijia_mark && event.player.storage.lijia_mark.contains(player);
				},
				content: function () {
					while (trigger.player.storage.lijia_mark.contains(player)) {
						trigger.player.storage.lijia_mark.remove(player);
					}
					if (trigger.player.storage.lijia_mark.length == 0) trigger.player.unmarkSkill('lijia_mark');
					lib.skill.lijia.sync(player, trigger.player);
				},
			},
			lijia_mark: {
				init: function (player, skill) {
					if (!player.storage[skill]) player.storage[skill] = [];
				},
				markimage:'image/mark/lijia.png',
			//	marktext: '理',
				intro: {
					name: '理家',
					content: '已成为$【理家】的目标',
				},
			},

			heimu: {
				audio: 2,
				trigger: { target: 'useCardToTargeted' },
				direct: true,
				filter: function (event, player) {
					return event.targets.length == 1 && get.type(event.card) != 'delay' && !player.hasSkill('heimu2') && player.countCards('h');
				},
				content: function () {
					'step 0'
					var list = ['弃置所有手牌，然后摸取等量的牌'];
					if (trigger.player.canAddJudge({ name: 'manzu_delay' }) && player.countCards('h')) list.push('将一张手牌当【延时满足】置入该角色的判定区');
					event.player.chooseControlList('是否发动【黑目】？', list, function (event, player) {
						var trigger = event.getTrigger();
						var target = trigger.player;
						var card = trigger.card;
						if (player == target) {
							if (!player.countCards('h', function (card) {
								return get.value(card) >= 5;
							})) {
								return 0;
							}
							return 1;
						}
						if (get.attitude(player, target) > 3 && !target.canAddJudge({ name: 'manzu_delay' })) return 1;
						if (player.countCards('h', { name: 'du' }) >= 2) return false;
						if (card == 'sha' && !player.countCards('h', { name: 'shan' })) return 0;
						if (!player.countCards('h', function (card) {
							return get.value(card) >= 8;
						})) {
							return 0;
						}
						return false;
					});
					'step 1'
					if (result.index == 0) {
						player.addTempSkill('heimu2');
						player.logSkill('heimu_draw');
						var cards = player.getCards('h');
						player.discard(cards);
						player.draw(cards.length);
						event.finish();
					}
					else if (result.index == 1) {
						player.addTempSkill('heimu2');
						player.logSkill('heimu_delay', trigger.player);
						player.chooseCard('h', '将一张手牌当做【延迟满足】置入<span class="bluetext">' + get.translation(trigger.player) + '</span>的判定区', true).set('ai', function (card) {
							return 7 - get.value(card);
						});
					}
					'step 2'
					if (result.bool) {
						trigger.player.addJudge({ name: 'manzu_delay' }, result.cards, player);
					}
				},
				subSkill:{
					draw:{
						audio:2,
						content:{},
					},
					delay:{
						audio:2,
						content:{},
					}
				}
			},
			heimu2: {},
			xiangfu: {
				global: 'xiangfu2',
				direct: true,
				audio:2,
				trigger: { player: 'gainAfter' },
				filter: function (event, player) {
					return event.cards.length >= 3;
				},
				content: function () {
					'step 0'
					player.chooseTarget('令一名其他角色摸一张牌', function (card, player, target) {
						return player != target;
					}, function (target) {
						return get.attitude(_status.event.player, target) * (target.maxHp + 1 - target.hp);
					});
					'step 1'
					if (result.targets && result.targets[0]) {
						player.logSkill('xiangfu', result.targets[0]);
						result.targets[0].draw();
					}
				},
			},
			xiangfu2: {
				direct: true,
				audio:2,
				trigger: { player: 'gainAfter' },
				filter: function (event, player) {
					return event.cards.length >= 3 && !player.hasSkill('xiangfu') && game.hasPlayer(function (current) {
						return current.hasSkill('xiangfu');
					});
				},
				content: function () {
					'step 0'
					var list = game.filterPlayer(function (target) {
						return target != player && target.hasSkill('xiangfu');
					});
					var str = '令' + get.translation(list);
					if (list.length > 1) str += '中的一人';
					str += '摸一张牌';
					player.chooseTarget(str, function (card, player, target) {
						return target.hasSkill('xiangfu') && player != target;
					}, function (target) {
						return get.attitude(_status.event.player, target) * (target.maxHp + 1 - target.hp);
					});
					'step 1'
					if (result.targets && result.targets[0]) {
						player.logSkill('xiangfu', result.targets[0]);
						result.targets[0].draw();
					}
				},
			},

			kangya: {
				audio: 2,
				forced: true,
				trigger: { player: 'damageBegin2' },
				logTarget: 'source',
				filter: function (event, player) {
					return event.source && !event.source.isLinked();
				},
				content: function () {
					'step 0'
					trigger.source.chooseBool(get.prompt("kangya"), "是否横置武将？若不横置则此伤害对" + get.translation(trigger.player) + "-1").set('ai', function (event) {
						var trigger = event.getTrigger();
						if (trigger.source == trigger.player) return true;
						if (trigger.source.getCards('e', { subtype: 'equip2' }).length && trigger.source.getCards('e', { subtype: 'equip2' })[0].name == 'tengjia' || trigger.source.hp == 1) return false;
						return get.damageEffect(player, trigger.source, trigger.source) >= 0;
					});
					'step 1'
					if (result.bool) {
						trigger.source.link(true);
						game.delay(0.5);
					}
					else {
						trigger.num--;
						game.delay(0.5);
					}
				},
			},
			tianyin: {
				audio: 2,
				trigger: { player: 'useCardToPlayer' },
				filter: function (event, player) {
					return event.targets.length == 1 && get.type(event.card) != 'delay' && event.target != player && player.countCards('h') && !event.target.isLinked();
				},
				content: function () {
					'step 0'
					event.cnt = 0;
					'step 1'
					if (trigger.targets.length == (game.players.length - 1) || trigger.targets[event.cnt] == player || trigger.targets[event.cnt].isLinked()) event.finish();
					else {
						trigger.targets[event.cnt].chooseControlList(get.translation('tianyin'), ['将武将牌横置', '令' + get.translation(player) + '为此牌再选择一名目标（无视距离）'], true, function (event, player) {
							if (player.getCards('e', { subtype: 'equip2' }).length && player.getCards('e', { subtype: 'equip2' })[0].name == 'tengjia' || player.hp == 1) return 1;
							if (get.attitude(player, trigger.player) > 0) return 1;
							if (game.hasPlayer(function (current) {
								if (trigger.targets.contains(current)) return false;
								return get.effect(current, { name: trigger.card.name }, trigger.player, player) > 0;
							})) return 0;
							return 1;
						});
					}
					'step 2'
					if (result.index == 0) {
						trigger.targets[event.cnt].link(true);
						event.finish();
					}
					else if (result.index == 1) {
						player.chooseTarget('选择<span class="yellowtext">' + get.translation(trigger.card) + '</span>的额外一名目标', function (card, player, target) {
							var trigger = _status.event.getTrigger();
							return player.canUse(trigger.card, target, false) && !trigger.targets.contains(target);
						}).set('ai', function (target) {
							return get.effect(target, { name: trigger.card.name }, player, player) > 0;
						});
					}
					else {
						event.finish();
					}
					'step 3'
					if (result.bool) {
						trigger.targets.push(result.targets[0]);
						event.cnt++;
						event.goto(1);
						game.delay(0.5);
					}
				},
			},
			fabing: {
				enable: 'phaseUse',
				usable: 1,
				audio: 2,
				content: function () {
					player.damage(1, 'fire', player);
				},
				ai: {
					basic: {
						order: 1
					},
					result: {
						player: function (player) {
							var num1 = game.countPlayer(function (current) {
								return get.attitude(player, current) > 0 && current.isLinked();
							});
							var num2 = game.countPlayer(function (current) {
								return get.attitude(player, current) < 0 && current.isLinked();
							});
							if (player.hp < 3) return -1;
							return num2 - num1 - 0.5;
						}
					}
				}
			},

			hongru: {
				mod: {
					targetInRange: function (card, player) {
						if ((card.name == 'sha' || card.name == 'sha_delay') && player.storage.hongru && (get.type(player.storage.hongru) == 'basic' || player.storage.hongru.name == 'sha_delay')) return true;
					},
					cardUsable: function (card, player) {
						if ((card.name == 'sha' || card.name == 'sha_delay') && player.storage.hongru && (get.type(player.storage.hongru) == 'basic' || player.storage.hongru.name == 'sha_delay')) return Infinity;
					}
				},
				group: 'hongru2',
				trigger: { player: 'useCard1' },
				filter: function (event, player) {
					return (event.card.name == 'sha' || event.card.name == 'sha_delay') && player.storage.hongru && (get.type(player.storage.hongru) == 'basic' || player.storage.hongru.name == 'sha_delay');
				},
				audio: 3,
				forced: true,
				firstDo: true,
				content: function () {
					trigger.addCount = false;
					if (player.stat[player.stat.length - 1].card.sha > 0 && trigger.card.name == 'sha') {
						player.stat[player.stat.length - 1].card.sha--;
					}
					else if (player.stat[player.stat.length - 1].card.sha_delay > 0 && trigger.card.name == 'sha_delay') {
						//	player.draw();
						player.stat[player.stat.length - 1].card.sha_delay--;
					}
				},
				ai: {
					effect: {
						player: function (card, player, target) {
							if (player.storage.hongru && (get.type(player.storage.hongru) == 'basic' || player.storage.hongru.name == 'sha_delay')) {
								if (card.name == 'sha') return 1.5;
								else if (card.name == 'sha_delay') return 1.5;
							}
							return 1;
						},
					}
				},
			},
			hongru2: {
				trigger: { player: 'useCardAfter' },
				forced: true,
				popup: false,
				content: function () {
					player.storage.hongru = trigger.card;
				},
			},
			shuangbiao: {
				audio: 2,
				trigger: { global: 'judge' },
				direct: true,
				preHidden: true,
				filter: function (event, player) {
					return !player.hasSkill('shuangbiao2');
				},
				content: function () {
					"step 0"
					player.chooseBool(get.translation(trigger.player) + '的' + (trigger.judgestr || '') + '判定为' +
						get.translation(trigger.player.judging[0]) + '，' + get.prompt('shuangbiao')).set('ai', function (event, player) {
							var trigger = _status.event.getTrigger();
							var player = _status.event.player;
							var judging = trigger.player.judging[0];
							var result = - trigger.judge(judging);
							var attitude = get.attitude(player, trigger.player);
							if (attitude == 0 || result == 0) return 0;
							if (attitude > 0) {
								return result > 0 ? true : false;
							}
							else {
								return -result > 0 ? true : false;
							}
						});
					"step 1"
					if (result.bool) {
						player.logSkill('shuangbiao', trigger.player);
						player.addTempSkill('shuangbiao2');
					}
					else {
						event.finish();
					}
					"step 2"
					trigger.player.judge(ui.ordering);
					'step 3'
					var str = '请选择一张牌作为' + get.translation(trigger.player) + '的' + (trigger.judgestr || '') + '判定牌';
					if (trigger.judge(trigger.player.judging[0]) == trigger.judge(result.card)) trigger.random = true;
					player.chooseButton(true, [str, [trigger.player.judging[0], result.card]]).set('ai', function (button) {
						var trigger = _status.event.getTrigger();
						if (trigger.random) return 5;
						var player = _status.event.player;
						var result = trigger.judge(button);
						var attitude = get.attitude(player, trigger.player);
						if (attitude == 0 || result == 0) return 0;
						if (attitude > 0) {
							return result;
						}
						else {
							return -result;
						}
					});
					'step 4'
					if (result.bool) {
						if (trigger.player.judging[0].clone) {
							trigger.player.judging[0].clone.classList.remove('thrownhighlight');
							game.broadcast(function (card) {
								if (card.clone) {
									card.clone.classList.remove('thrownhighlight');
								}
							}, trigger.player.judging[0]);
							game.addVideo('deletenode', player, get.cardsInfo([trigger.player.judging[0].clone]));
						}
						game.log(player, '在两张判定牌中选择了', result.links[0]);
						if (result.links[0] == trigger.player.judging[0]) {
							game.delay();
						}
						else {
							game.cardsDiscard(trigger.player.judging[0]);
							trigger.player.judging[0] = result.links[0];
							trigger.orderingCards.addArray(result.links);
							game.delay();
						}
					}
					'step 5'
					if(result.bool){
						var card=(result.links[0] == trigger.player.judging[0]?trigger.player.judging[0]:result.links[0]);
						game.broadcastAll(function (player, card, cardid) {
							var event;
							if (game.online) {
								event = {};
							}
							else {
								event = _status.event;
							}
							if (game.chess) {
								event.node = card.copy('thrown', 'center', ui.arena).animate('start');
							}
							else {
								event.node = player.$throwordered(card.copy(), true);
							}
							if (lib.cardOL) lib.cardOL[cardid] = event.node;
							event.node.cardid = cardid;
							event.node.classList.add('thrownhighlight');
							ui.arena.classList.add('thrownhighlight');
						}, player, card, get.id());
						trigger.node=event.node;
					}
				},
				ai: {
					rejudge: true,
					tag: {
						rejudge: 1,
					}
				}
			},
			shuangbiao2: {},

			//星盘及七星牌
			xingpan: {
				direct: true,
				trigger: {
					global: "phaseBefore",
				},
				filter: function (event, player) {
					if (!player.storage.xingpan_inited) return true;
				},
				content: function () {
					if (!player.storage.xingpan_inited) {
						player.storage.xingpan_inited = true;
					}
					var cards = [];
					var card;
					card = game.createCard('BJX_tianshu', '', '');
					card.node.info.remove();
					//		card.node.name.remove();
					cards.push(card);
					card = game.createCard('BJX_tianxuan', '', '');
					card.node.info.remove();
					//		card.node.name.remove();
					cards.push(card);
					card = game.createCard('BJX_tianji', '', '');
					card.node.info.remove();
					//		card.node.name.remove();
					cards.push(card);
					card = game.createCard('BJX_tianquan', '', '');
					card.node.info.remove();
					//	card.node.name.remove();
					cards.push(card);
					card = game.createCard('BJX_yuheng', '', '');
					card.node.info.remove();
					//	card.node.name.remove();
					cards.push(card);
					card = game.createCard('BJX_kaiyang', '', '');
					card.node.info.remove();
					//	card.node.name.remove();
					cards.push(card);
					card = game.createCard('BJX_yaoguang', '', '');
					card.node.info.remove();
					//	card.node.name.remove();
					cards.push(card);

					//	card = get.cards(2);
					//	cards.push(card[0]);
					//	cards.push(card[1]);

					player.storage.xingpan = cards;
					player.logSkill('jiheng');
					player.markSkill('xingpan');
				},
				markimage:'image/mark/xing.png',
				intro: {
					name: '',
					content: 'cards',
				},
			},
			xingpan_dying: {
				trigger: { global: 'dying' },
				//priority:6,
				filter: function (event, player) {
					return event.player.hp <= 0 && player.storage.jiheng && player.storage.jiheng.contains(event.player) && event.player.storage.Bxing != 'none' && !player.storage.c.contains(event.player.storage.Bxing);
				},
				direct: true,
				content: function () {
					player.storage.c.push(trigger.player.storage.Bxing);
					for (var i = 0; i < player.storage.xingpan.length; i++) {
						if (trigger.player.storage.Bxing === 'B' + player.storage.xingpan[i].name.substring(4)) {
							player.storage.xingpan[i].copy = function () {
								var node = this.cloneNode(true);
								node.style.transform = this.transform;
								node.name = this.name;
								node.suit = this.suit;
								node.number = this.number;
								node.classList.remove('hidden');
								node.classList.remove('start');
								node.classList.remove('thrown');
								node.classList.remove('selectable');
								node.classList.remove('selected');
								node.classList.remove('removing');
								node.classList.remove('drawinghidden');
								node.classList.remove('glows');
								node.node = {
									name: node.querySelector('.name'),
									info: node.querySelector('.info'),
									intro: node.querySelector('.intro'),
									background: node.querySelector('.background'),
									image: node.querySelector('.image'),
									gaintag: node.querySelector('.gaintag'),
								}
								node.node.gaintag.innerHTML = '';
								var clone = true;
								var position;
								for (var i = 0; i < arguments.length; i++) {
									if (typeof arguments[i] == 'string') node.classList.add(arguments[i]);
									else if (get.objtype(arguments[i]) == 'div') position = arguments[i];
									else if (typeof arguments[i] == 'boolean') clone = arguments[i];
								}
								node.moveTo = lib.element.card.moveTo;
								node.moveDelete = lib.element.card.moveDelete;
								if (clone) this.clone = node;
								if (position) position.appendChild(node);
								return node;
							};
							player.storage.xingpan[i].transform = 'rotate(180deg)';
							player.storage.xingpan[i].c = true;
						}
					}
				},
			},
			xingpan_dieafter: {
				trigger: { global: 'dieAfter' },
				//priority:6,
				filter: function (event, player) {
					return player.storage.xingpan;
				},
				direct: true,
				content: function () {
					'step 0'
					player.chooseButton(['请弃置一张七星牌', player.storage.xingpan], true, function (button) {
						return true;
					}, function (button) {
						if (button.name.indexOf('BJX_') != -1) return true;
						return false;
					});
					'step 1'
					if (result.bool) {
						player.storage.xingpan.remove(result.links[0]);
						player.lose(result.links, ui.special);
						player.$throw(result.links,1000);
						game.log(player, '将', result.links, '从', '#s星盘', '中移除了');
						player.update();
					}
				},
			},

			Bziwei: {
				trigger: { player: 'recoverBefore' },
				direct: true,
				audio: 2,
				group: 'Bziwei_draw',
				filter: function (event, player) {
					return !event.nature;
				},
				content: function () {
					trigger.nature = 'star';
				},
				ai: {
					threaten: 1.5,
				},
				subSkill: {
					draw: {
						audio: 'Bziwei',
						forced: true,
						trigger: { global: 'recoverAfter' },
						filter: function (event, player) {
							return event.nature == 'star';
						},
						content: function () {
							player.draw('nodelay');
						},
					}
				},
			},
			Btianshu: {
				mod: {
					cardUsable: function (card, player, num) {
						if (card.name == 'sha') return num + 1;
					}
				},
				charlotte: true,
			},
			Btianshu_c: {
				mod: {
					cardEnabled2: function (card) { if (card.name == 'sha') return false }
				},
				charlotte: true,
			},
			Btianxuan: {
				trigger: { player: 'useCardBefore' },
				forced: true,
				audio: 2,
				filter: function (event, player) {
					return get.type(event.card, 'trick') == 'trick';
				},
				content: function () {
					trigger.nowuxie = true;
				},
				ai: {
					threaten: 1.2,
				},
			},
			Btianxuan_c: {
				mod: {
					cardname: function (card, player) {
						if (get.type(card, 'trick', player, true) == 'trick') return 'shan';
					},
				},
			},
			Btianji: {
				trigger: { player: 'phaseDrawBegin2' },
				forced: true,
				filter: function (event, player) {
					return !event.numFixed;
				},
				content: function () {
					trigger.num++;
				},
			},
			Btianji_c: {
				audio: 2,
				trigger: { player: 'phaseDrawBegin2' },
				forced: true,
				filter: function (event, player) {
					return !event.numFixed;
				},
				content: function () {
					trigger.num--;
				},
			},
			Btianquan: {
				trigger: { player: 'phaseJieshuBegin' },
				forced: true,
				filter: function (event, player) {
					return player.hasHistory('useCard', function (evt) {
						return get.type(evt.card, 'trick') == 'trick';
					});
				},
				content: function () {
					player.draw(2);
				},
			},
			Btianquan_c: {
				trigger: { player: 'phaseJieshuBegin' },
				forced: true,
				filter: function (event, player) {
					return !player.hasHistory('useCard', function (evt) {
						return get.type(evt.card, 'trick') == 'trick';
					});
				},
				content: function () {
					player.loseHp(1);
				},
			},
			Byuheng: {
				trigger: { player: 'phaseZhunbeiEnd' },
				direct: true,
				filter: function (event, player) {
					return player.countCards('he');
				},
				content: function () {
					'step 0'
					player.chooseToDiscard(get.prompt("Byuheng"), '弃置任意张牌，然后摸等量的牌', [1, Infinity], 'he').set('ai', function (card) {
						return get.value(card) < 6;
					});
					'step 1'
					if (result.bool) {
						player.logSkill('Byuheng');
						player.draw(result.cards.length);
					}
				},
			},
			Byuheng_c: {
				trigger: { player: 'phaseZhunbeiEnd' },
				forced: true,
				filter: function (event, player) {
					return player.countCards('he');
				},
				content: function () {
					var cards = player.getCards('he');
					player.discard(cards);
					player.draw(cards.length);
					event.finish();
				},
			},
			Bkaiyang: {
				audio: 2,
				trigger: { player: 'phaseJieshuBegin' },
				forced: true,
				filter: function (event, player) {
					return player.hasHistory('sourceDamage', function (evt) {
						return true;
					});
				},
				content: function () {
					player.draw(2);
				},
			},
			Bkaiyang_c: {
				audio: 2,
				trigger: { player: 'phaseJieshuBegin' },
				forced: true,
				filter: function (event, player) {
					return !player.hasHistory('sourceDamage', function (evt) {
						return true;
					});
				},
				content: function () {
					player.loseHp(1);
				},
			},
			Byaoguang: {
				direct: true,
				trigger: { source: 'damageBegin2' },
				content: function () {
					'step 0'
					player.chooseBool(get.prompt("Byaoguang"), "是否失去1点体力，令对" + get.translation(trigger.player) + "的伤害+1？").set('ai', function (event, player) {
						var trigger = event.getTrigger();
						if (player.hp < 2) return false;
						var nature;
						if (trigger.card) nature = trigger.card.nature;
						return get.damageEffect(trigger.player, player, player, nature) > 0 ? true : false;
					});
					'step 1'
					if (result.bool) {
						player.logSkill('Byuheng');
						player.loseHp(1);
						trigger.num++;
					}
				},
			},
			Byaoguang_c: {
				forced: true,
				trigger: { source: 'damageBegin2' },
				content: function () {
					player.loseHp(trigger.num);
				},
			},

			jiheng: {
				audio: 4,
				trigger: { player: 'phaseZhunbeiBegin' },
				group: ['xingpan', 'xingpan_dying', 'xingpan_dieafter'],
				prompt2: '准备阶段，你可以对“星盘”进行操作，然后令“星盘”对应的效果立即生效。',
				init: function (player, skill) {
					if (!player.storage[skill]) player.storage.c = [];
				},
				check: function (event, player) {
					if (game.phaseNumber == 1) return false;
					var num = Math.random();
					return num > 0.7 ? false : true;
				},
				content: function () {
					'step 0'
					player.chooseToXingpan(player.storage.xingpan, player.getCards('h'));
					'step 1'
					if (result.bool) {
						player.storage.xingpan = result.cards;
						player.markSkill('xingpan');
					}
					else event.finish();
					'step 2'
					event.cnt = -1;
					event.nowplayer = player;
					event.nowplayer.storage.jiheng = [];
					for (var i = 0; i < game.players.length; i++) game.players[i].storage.Bxing = 'none';
					'step 3'
					event.player = event.player.next;
					event.cnt++;
					'step 4'
					//		console.log(event.cnt,event.nowplayer.storage.xingpan,event.nowplayer.storage.jiheng,game.players.length);
					if (event.cnt == event.nowplayer.storage.xingpan.length || event.nowplayer.storage.jiheng.length == game.players.length) event.goto(5);
					else if (event.nowplayer.storage.jiheng.contains(event.player)) {
						event.cnt--;
						event.goto(3);
					}
					else {
						if (event.nowplayer.storage.xingpan[event.cnt].name.indexOf('BJX_') != -1) {
							event.nowplayer.storage.jiheng.push(event.player);
							var skill = 'B' + event.nowplayer.storage.xingpan[event.cnt].name.substring(4);
							event.player.storage.Bxing = skill;
							if (event.nowplayer.storage.c.contains(skill)) skill += '_c';
							event.player.addAdditionalSkill('jiheng_' + event.nowplayer.playerid, skill);
							event.player.markSkillSpecial('jiheng_' + event.nowplayer.playerid, event.player, skill, get.translation(skill), get.translation(skill + '_info'));
							event.player.popup(skill);
							game.log(event.player, '获得了', '#g【' + get.translation(skill) + '】');
							//		console.log('B' + event.nowplayer.storage.xingpan[event.cnt].name.substring(4));
						}
						event.goto(3);
					}
					'step 5'
					event.nowplayer.addTempSkill('jiheng_clear', { player: 'phaseBegin' });
					if (!event.nowplayer.storage.jiheng.contains(event.nowplayer) && event.nowplayer.hasSkill('ziwei')) {
						event.nowplayer.addTempSkill('Bziwei', { player: 'phaseBegin' });
						event.nowplayer.markSkillSpecial('jiheng_' + event.nowplayer.playerid, event.nowplayer, 'Bziwei', get.translation('Bziwei'), get.translation('Bziwei_info'));
						event.nowplayer.popup('Bziwei');
						game.log(event.nowplayer, '获得了', '#g【' + get.translation('Bziwei') + '】');
					}
				},
				subSkill: {
					clear: {
						onremove: function (player) {
							game.countPlayer(function (current) {
								current.removeAdditionalSkill('jiheng_' + player.playerid);
								current.unmarkSkill('jiheng_' + player.playerid);
							});
						},
					},
				}
			},
			ziwei: {
				audio: 3,
				forced:true,
			//	frequent: true,
				trigger: { player: 'damageAfter' },
				content: function () {
					'step 0'
					var num = player.getHistory('damage', null).length;
					if (num)
						player.chooseToGuanxing(num * 2);
					'step 1'
					player.draw();
				},
				ai: {
					effect: {
						target: function (card, player, target) {
							if (player.hasSkillTag('jueqing', false, target)) return [1, -1];
							var num = player.getHistory('damage', null).length;
							if (get.tag(card, 'damage') && player != target) return [1, 1 - num * 0.2];
						},
					},
				}
			},

			shensuan: {
				audio: 2,
				group: ['shensuan2'],
				forced: true,
				trigger: { global: 'drawBefore' },
				filter: function (event, player) {
					return _status.currentPhase == player;
				},
				content: function () {
					'step 0'
					player.chooseToGuanxing(trigger.num + 1);
				},
			},
			shensuan2: {
				audio: 'shensuan',
				forced: true,
				trigger: { player: 'damageAfter' },
				content: function () {
					'step 0'
					player.chooseToGuanxing(3);
				},
				ai: {
					effect: {
						target: function (card, player, target) {
							if (player.hasSkillTag('jueqing', false, target)) return [1, -1];
							var num = player.getHistory('damage', null).length;
							if (get.tag(card, 'damage') && player != target) return [1, 1 - num * 0.15];
						},
					},
				}
			},
			guili: {
				audio: 2,
				enable: 'phaseUse',
				usable: 1,
				filter: function (event, player) {
					return game.hasPlayer(function (current) {
						return current.countCards('h');
					});
				},
				filterTarget: function (card, player, target) {
					return target.countCards('h') && player != target;
				},
				content: function () {
					"step 0"
					var cards = target.getCards('h');
					event.num = cards.length;
					target.lose(cards, ui.cardPile, 'insert');
					game.updateRoundNumber();
					"step 1"
					target.draw(event.num);
					if (!player.storage.guili) event.finish();
					'step 2'
					if(!target.countCards('h')) event.finish();
					else target.showHandcards();
					"step 3"
					var cards = target.getCards('h');
					var color = get.color(cards[0], player);
					for (var i = 1; i < cards.length; i++) {
						if (get.color(cards[i], player) != color) return;
					}
					if (color == 'red') player.draw();
					else if (color == 'black') target.damage(1, player);
				},
				ai: {
					order: 7.8,
					result: {
						target: -1,
						player: 0.5,
					},
				}
			},
			guili_gai: {},
			zhiju: {
				skillAnimation: true,
				animationColor: 'thunder',
				audio: 2,
				group: ['zhiju_count'],
				derivation: ['daican', 'guili_gai'],
				unique: true,
				juexingji: true,
				trigger: { player: 'phaseZhunbeiBegin' },
				forced: true,
				filter: function (event, player) {
					return (!player.hasSkill('daican') || !player.storage.guili) && player.countMark('zhiju') >= 7;
				},
				content: function () {
					"step 0"
					player.recover();
					player.awakenSkill('zhiju');
					"step 1"
					player.chooseControl('获得【代餐】并失去【桂离】', '修改【桂离】', true, function (event, player) {
						if (game.countPlayer(function (current) {
							return get.attitude(player, current) > 0;
						}) > game.countPlayer(function (current) {
							return get.attitude(player, current) < 0;
						})) return 0;
						return 1;
					}).set('prompt', '请选择一项');
					"step 2"
					if (result.control == '获得【代餐】并失去【桂离】') {
						game.log(player, '选择获得', '#g【代餐】', '并失去', '#g【桂离】');
						player.addSkill('daican');
						player.removeSkill('guili');
					}
					else if (result.control == '修改【桂离】') {
						game.log(player, '选择修改', '#g【桂离】');
						player.storage.guili = true;
					}

				},
				markimage:'image/mark/ju.png',
			//	marktext: "局",
				intro: {
					name: "局",
					content: '共有$个标记',
				},
			},
			zhiju_count: {
				forced: true,
				silent: true,
				popup: false,
				trigger: { player: 'chooseToGuanxingAfter' },
				content: function () {
					console.log("111")
					player.addMark('zhiju');
				},
			},


			//别在这里发癫
			/*		yinchuang:{
						global: ['yinchuang2'],
						forced: true,
						trigger: { source: 'damageAfter' },
						content: function () {
							player.addMark('yinchuang2');
						},
					},
					yinchuang2:{
						forced: true,
						trigger: { source: 'damageBegin2' },
						filter:function(event,player){
							return player.countMark('yinchuang2');
						},
						content: function () {
							trigger.num+=player.countMark('yinchuang2');
						},
						marktext: "牛",
						intro: {
							name: "牛",
							content: '共有$个标记',
						},
					},
					zhongji:{
						trigger: { player: 'useCard1' },
						forced: true,
						audio: 2,
						filter: function (event, player) {
							return get.number(event.card) !=null;
						},
						content: function () {
							if(trigger.card=='trick')
						},
						ai: {
							threaten: 1.2,
						},
					},
					liudu:{
		
					},*/
			niupi: {
				audio: 2,
				trigger: { global: 'phaseJieshuBegin' },
				filter: function (event, player) {
					return event.player != player && event.player.getHistory('useCard').length >= 3 && !event.player.hasMark('niupi');
				},
				check: function (event, player) {
					if (get.attitude(player, event.player) > 0 && player.storage.niuduo_way == 1) return true;
					else if (get.attitude(player, event.player) < 0 && player.storage.niuduo_way == 2 && !player.storage.niuduo && game.countPlayer(function (current) {
						return current.hasMark('niupi');
					}) <= 2) return true;
					else if (get.attitude(player, event.player) < 0 && player.storage.niuduo) return true;
					return false;
				},
				content: function () {
					trigger.player.addMark('niupi');
				},
				marktext: "牛",
				intro: {
					name: "牛",
					content: '勇敢牛牛，不怕困难！',
				},
				ai: {
					expose:0.2,
				}
			},
			niuduo: {
				unique: true,
				limited: true,
				audio: 2,
				trigger: { player: 'phaseZhunbeiBegin' },
				direct: true,
				filter: function (event, player) {
					return !player.storage.niuduo;
				},
				init: function (player) {
					player.storage.niuduo = false;
					if (player.identity == 'zhu') player.storage.niuduo_way = 1;
					else player.storage.niuduo_way = Math.random() < 0.5 ? 1 : 2;
				},
				mark: true,
				marktext:'堕',
				intro: {
					content: 'limited'
				},
				derivation: ['liudu', 'benghuai', 'kaichuang', 'zhongji'],
				skillAnimation: true,
				animationColor: 'fire',
				content: function () {
					'step 0'
					event.num = game.countPlayer(function (current) {
						return current.hasMark('niupi');
					});
					player.chooseControlList('是否发动【牛堕】？', ['增加' + get.cnNumber(event.num) + '点体力上限并回复' + get.cnNumber(event.num) + '点体力，获得技能【流毒】和【崩坏】。', '减少' + get.cnNumber(event.num) + '点体力上限，获得技能【开创】和【终极】。'], function (event, player) {
						if (player.storage.niuduo_way == 1 && Math.random() <= 0.2 + game.countPlayer(function (current) {
							return current.hasMark('niupi');
						}) / game.players.length) return 0;
						if (player.storage.niuduo_way == 2) return 1;
						return false;
					});
					'step 1'
					if (result.index == 0) {
						player.storage.niuduo = true;
						player.awakenSkill('niuduo');
						player.logSkill('niuduo');
						if (event.num) player.gainMaxHp(event.num);
						if (event.num) player.recover(event.num);
						player.addSkill(['liudu', 'benghuai']);
					}
					else if (result.index == 1) {
						player.storage.niuduo = true;
						player.awakenSkill('niuduo');
						player.logSkill('niuduo');
						if (event.num) player.loseMaxHp(event.num);
						player.addSkill(['kaichuang', 'zhongji']);
					}
				},
				ai: {
					threaten: 2,
				}
			},
			liudu: {
				audio: 2,
				trigger: { player: 'damageBegin1' },
				filter: function (event, player) {
					return event.num;
				},
				forced: true,
				content: function () {
					'step 0'
					if (trigger.source&&trigger.source.hasMark('niupi')) {
						player.draw();
						trigger.num++;
						event.finish();
					}
					else if(trigger.source&&!trigger.source.hasMark('niupi')){
						player.draw();
						trigger.num--;
					}
					'step 1'
					player.addGaintag(result[0], 'liudu');
				},
				mod: {
					cardname: function (card, player) {
						if (get.itemtype(card) == 'card' && card.hasGaintag('liudu')) return 'du';
					},
				},
				ai: {
					effect: {
						target: function (card, player, target) {
							if (!get.tag(card, 'damage')) return 1;
							if (!player.hasMark('niupi')) {
								return 0.5;
							}
							else return 1.5;
						}
					}
				}
			},
			kaichuang: {
				audio: 2,
				usable: 1,
				preHidden: true,
				trigger: { source: 'damageBegin1' },
				filter: function (event, player) {
					return player != event.player && event.num < event.player.hp && event.player.hasMark('niupi');
				},
				check: function (event, player) {
					if (get.attitude(player, event.player) > -2) return false;
					if (player.hp > 2) return true;
					if (player.hp == 2 && event.player.hp < 3) return false;
					return player.hp > 1;
				},
				logTarget: 'player',
				content: function () {
					player.loseHp();
					trigger.player.removeMark('niupi');
					trigger.player.addTempSkill('kaichuang2');
					trigger.kaichuang_num = trigger.player.hp - trigger.num;
					trigger.num = trigger.player.hp;
				},
			},
			kaichuang2: {
				trigger: { player: 'damageEnd' },
				forced: true,
				popup: false,
				charlotte: true,
				filter: function (event, player) {
					return typeof event.kaichuang_num == 'number';
				},
				content: function () {
					player.recover(trigger.kaichuang_num);
				},
			},
			zhongji: {
				mod: {
					maxHandcardBase: function (player, num) {
						return Math.min(game.countPlayer(function(current){
							return current.hasMark('niupi');
						}),3);
					}
				},
				audio: 2,
				group: 'zhongji2',
				trigger: { source: 'damageBegin4' },
				filter: function (event,player) {
					return _status.currentPhase==player&&event.num >= 3;
				},
				forced: true,
				content: function () {
					player.draw(1);
				},
			},
			zhongji2: {
				forced: true,
				trigger: { player: 'useCard' },
				filter: function (event, player) {
					return _status.currentPhase==player&&player.getHistory('useCard').length == 3;
				},
				audio: 2,
				content: function () {
					player.draw(1);
				},
			},

			changsheng: {
				/*	mod: {
						aiOrder: function (player, card, num) {
							if (player.isPhaseUsing() && get.subtype(card) == 'equip1' && !get.cardtag(card, 'gifts')) {
								var range0 = player.getAttackRange();
								var range = 0;
								var info = get.info(card);
								if (info && info.distance && info.distance.attackFrom) {
									range -= info.distance.attackFrom;
								}
								if (player.getEquip(1)) {
									var num = 0;
									var info = get.info(player.getEquip(1));
									if (info && info.distance && info.distance.attackFrom) {
										num -= info.distance.attackFrom;
									}
									range0 -= num;
								}
								range0 += range;
								if (range0 == (player.getHistory('useCard').length + player.getHistory('respond').length + 2) && player.countCards('h', function (cardx) {
									return get.subtype(cardx) != 'equip1' && player.getUseValue(cardx) > 0;
								})) return num + 10;
							}
						},
					},*/
				audio: 2,
				enable: 'phaseUse',
				usable: 1,
				filter: function (event, player) {
					if (player.countCards('h') == 0) return false;
					return game.hasPlayer(function (current) {
						return current.countCards('h');
					});
				},
				filterTarget: function (card, player, target) {
					return player.canCompare(target);
				},
				content: function () {
					"step 0"
					player.chooseToCompare(target);
					"step 1"
					if (result.bool) {
						var num = get.number(result.player) - get.number(result.target);
						if (num > 0)
							player.draw(num);
					}
					else {
						//	player.gain(result.player, 'gain2');
						target.gain(result.target, 'gain2');
					}
				},
				ai: {
					order: 1.5,
					result: {
						target: -0.5,
						player: function (player) {
							if (player.countCards('h') > player.maxHp) return -1;
							return 1;
						},
					},
				}
			},
			choutai: {
				forced: true,
				trigger: { player: 'drawBefore' },
				group: ['choutai2'],
				filter: function (event, player) {
					//		var num = Math.max(player.getAttackRange(), player.countCards('j'));
					var num = player.maxHp;
					return event.num < num;
				},
				content: function () {
					trigger.num++;
					trigger.numFixed = true;
				},
				ai: {
					/*	effect: {
							target: function (card, player, target) {
								if (player != target || !player.isPhaseUsing()) return;
								if (get.subtype(card) == 'equip1' && !get.cardtag(card, 'gifts')) {
									var range0 = player.getAttackRange();
									var range = 0;
									var info = get.info(card);
									if (info && info.distance && info.distance.attackFrom) {
										range -= info.distance.attackFrom;
									}
									if (player.getEquip(1)) {
										var num = 0;
										var info = get.info(player.getEquip(1));
										if (info && info.distance && info.distance.attackFrom) {
											num -= info.distance.attackFrom;
										}
										range0 -= num;
									}
									range0 += range;
									var delta = range0 - (player.getHistory('useCard').length + player.getHistory('respond').length);
									if (delta < 0) return;
									var num = player.countCards('h', function (card) {
										return (get.cardtag(card, 'gifts') || get.subtype(card) != 'equip1') && player.getUseValue(card) > 0;
									});
									if (delta == 2 && num > 0) return [1, 3];
									if (num >= delta) return 'zeroplayertarget';
								}
								var att = get.attitude(target, player);
								if (att >= 0 && get.type(card) == 'delay') return 1.5;
								else if (get.type(card) == 'delay') return 0.5;
								return 1;
							},
						},*/
				},
			},
			choutai2: {
				forced: true,
				trigger: { player: 'drawAfter' },
				filter: function (event, player) {
					//		var num = Math.max(player.getAttackRange(), player.countCards('j'));
					var num = player.maxHp;
					return !event.numFixed && player.countCards('h') > num;
				},
				content: function () {
					//	var num = Math.max(player.getAttackRange(), player.countCards('j'));
					var num = player.maxHp;
					player.chooseToDiscard('###丑态###请弃置' + get.cnNumber(player.countCards('h') - num) + '张牌', player.countCards('h') - num, true, 'h', function (card) {
						return true;
						//	var trigger = _status.event.getParent().getTrigger();
						//	if (!trigger.result.length) return true;
						//	if (trigger.result.contains(card)) return true;
						//	return false;
					});
				},
			},

			guishu: {
				derivation: ['qiufo'],
				forced: true,
				group: ['guishu2'],
				trigger: { player: 'phaseUseBegin' },
				content: function () {
					'step 0'
					event.prompt = '将一张诡牌洗入牌堆中';
					player.chooseButton([event.prompt, [['Mchenshi', 'Myishi', 'Mhuadeng'], 'vcard']], true, function (button) {
						return Math.floor(Math.random() * 3);
					});
					'step 1'
					if (result.links[0][2] == 'Mchenshi') { //黑桃3
						var card = game.createCard('Mchenshi', 'spade', 3);
						var cards = ui.cardPile.childNodes;
						var num = Math.floor(Math.random() * cards.length);
						ui.cardPile.insertBefore(card.fix(), cards[num]);
						game.log(player, '将一张诡牌洗入了牌堆中');
					}
					else if (result.links[0][2] == 'Myishi') { //梅花3
						var card = game.createCard('Myishi', 'club', 3);
						var cards = ui.cardPile.childNodes;
						var num = Math.floor(Math.random() * cards.length);
						ui.cardPile.insertBefore(card.fix(), cards[num]);
						game.log(player, '将一张诡牌洗入了牌堆中');
					}
					else if (result.links[0][2] == 'Mhuadeng') { //红桃3
						var card = game.createCard('Mhuadeng', 'heart', 3);
						var cards = ui.cardPile.childNodes;
						var num = Math.floor(Math.random() * cards.length);
						ui.cardPile.insertBefore(card.fix(), cards[num]);
						game.log(player, '将一张诡牌洗入了牌堆中');
					}
					'step 2'
					game.updateRoundNumber();
				},
			},
			guishu2: {
				forced: true,
				popup: false,
				trigger: { global: 'guishu1' },
				content: function () {
					var next = player.chooseDrawRecover(2).set('logSkill', 'guishu').set('prompt', get.prompt('guishu'));
					next.set('choice', function (event, player) {
						if (player.hp == 1 && player.isDamaged()) return 'recover_hp';
						return 'draw_card';
					});
					next.set('ai', function () {
						return _status.event.getParent().choice;
					});
					next.setHiddenSkill('guishu2');
				},
			},
			qiufo: {
				audio: 2,
				trigger: { player: 'phaseJieshuBegin' },
				forced: true,
				filter: function (event, player) {
					return !player.hasHistory('sourceDamage', function (evt) {
						return true;
					});
				},
				content: function () {
					'step 0'
					player.loseHp(1);
					'step 1'
					player.chooseTarget('对一名其他角色造成一点伤害', true, function (card, player, target) {
						if (target == player) return false;
						return true;
					}).set('ai', function (target) {
						if (get.attitude(_status.event.player, target) < 0) return 10;
						return 1;
					});
					'step 2'
					if (result.bool) {
						result.targets[0].damage(1, player);
					}
				},
			},
			_Mchenshi: {
				trigger: { player: 'drawAfter' },
				popup: false,
				forced: true,
				filter: function (event, player) {
					for (var i = 0; i < event.result.length; i++)
						if (event.result[i].name == 'Mchenshi') return true;
					return false;
				},
				content: function () {
					"step 0"
					event.list = [];
					for (var i = 0; i < trigger.result.length; i++)
						if (trigger.result[i].name == 'Mchenshi') event.list.push(trigger.result[i]);
					"step 1"
					player.showCards(event.list, '展示【尘世歌者】');
					'step 2'
					event.trigger('guishu1');
					"step 3"
					var card = event.list.pop();
					player.damage(2, 'thunder', card, 'nosource');
					"step 4"
					if (event.list.length) {
						event.goto(2);
					}
				},
			},
			_Myishi: {
				trigger: { player: 'drawAfter' },
				popup: false,
				forced: true,
				filter: function (event, player) {
					for (var i = 0; i < event.result.length; i++)
						if (event.result[i].name == 'Myishi') return true;
					return false;
				},
				content: function () {
					"step 0"
					event.list = [];
					for (var i = 0; i < trigger.result.length; i++)
						if (trigger.result[i].name == 'Myishi') event.list.push(trigger.result[i]);
					"step 1"
					player.showCards(event.list, '展示【一世情缘】');
					'step 2'
					event.trigger('guishu1');
					"step 3"
					if (!player.hasSkill('qiufo'))
						player.addSkill('qiufo');
				},
			},
			_Mhuadeng: {
				trigger: { player: 'drawAfter' },
				popup: false,
				forced: true,
				filter: function (event, player) {
					for (var i = 0; i < event.result.length; i++)
						if (event.result[i].name == 'Mhuadeng') return true;
					return false;
				},
				content: function () {
					"step 0"
					event.list = [];
					for (var i = 0; i < trigger.result.length; i++)
						if (trigger.result[i].name == 'Mhuadeng') event.list.push(trigger.result[i]);
					"step 1"
					player.showCards(event.list, '展示【华灯初上】');
					'step 2'
					event.trigger('guishu1');
					"step 3"
					var card = event.list.pop();
					player.draw(3);
					player.turnOver();
					"step 4"
					if (event.list.length) {
						event.goto(2);
					}
				},
			},
			_guipai_destroy: {
				trigger: { global: ['loseEnd', 'cardsDiscardEnd'] },
				forced: true,
				charlotte: true,
				filter: function (event, player) {
					var cs = event.cards;
					for (var i = 0; i < cs.length; i++) {
						if (cs[i].name.indexOf('M') == 0 && get.position(cs[i], true) == 'd') return true;
					}
					return false;
				},
				forceDie: true,
				content: function () {
					if (!_status.fumian) _status.fumian = {};
					var list = [];
					var cs = trigger.cards;
					for (var i = 0; i < cs.length; i++) {
						if (cs[i].name.indexOf('M') == 0 && get.position(cs[i], true) == 'd') {
							_status.fumian[cs[i].name] = false;
							list.push(cs[i]);
						}
					}
					game.cardsGotoSpecial(list);
				},
			},



			//chengjiu
			CLxiangwan2: {
				trigger: { player: 'useCard1' },
				forced: true,
				locked: true,
				direct: true,
				silent: true,
				filter: function (event, player) {
					if (event.card.name == 'Smingan' || event.card.name == 'Skeai' || event.card.name == 'Shaixiu' || event.card.name == 'Saojiao') return true;
				},
				content: function () {
					player.checkChallenge(event, 'CLxiangwan2', 'character', 'onehun');
				},
			},
			CLheicao1: {
				trigger: { player: 'useCard1' },
				forced: true,
				locked: true,
				direct: true,
				silent: true,
				filter: function (event, player) {
					if (event.card.name == 'shebei') return true;
				},
				content: function () {
					if (!player.storage.CLheicao1) player.storage.CLheicao1 = 0;
					player.storage.CLheicao1++;
					if (player.storage.CLheicao1 >= 8) {
						player.checkChallenge(event, 'CLheicao1', 'character', 'onehun');
						player.removeSkill('CLheicao1');
					}
				},
			},
			CLjiaran4: {
				forced: true,
				locked: true,
				global: ['CLjiaran4_global'],
				subSkill: {
					global: {
						trigger: { player: 'die' },
						forced: true,
						locked: true,
						direct: true,
						silent: true,
						filter: function (event) {
							return player.name == 'xiangwan' && event.source && event.source.name == 'jiaran';
						},
						content: function () {
							event.source.checkChallenge(event, 'CLjiaran4', 'character', 'onehun');
							event.source.removeSkill('CLjiaran4');
						},
					}
				}
			}
		},
		challenge: {
			character: {
				onehun: {
					CLxiangwan1: {
						level: [5, 20, 50],
						over: true,
						info: '使用向晚赢得###场胜利。',
						name: '顶碗人',
						word: '晚',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLxiangwan2: {
						level: [10, 40, 100],
						info: '使用向晚在对局中使用###张水母牌。',
						name: '水母之歌',
						word: '晚',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						skill: 'CLxiangwan2',
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLxiangwan3: {
						info: '使用向晚，在对局中使用【要强】一次获得4张水母牌。',
						name: '枝江才女',
						word: '晚',
						reward: {
							'0': ['reward1', 100],
						},
						need: 1,
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							if (event.num1 == 4) return true;
							return false;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLbeila1: {
						level: [5, 20, 50],
						over: true,
						info: '使用贝拉赢得###场胜利。',
						name: '贝极星',
						word: '贝',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLbeila2: {
						level: [10, 40, 100],
						info: '使用贝拉，在对局中总计赢得###次【舞斗】。',
						name: 'Shiny Dancer',
						word: '贝',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							if (event.winner == game.me) return true;
							return false;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLbeila3: {
						info: '使用贝拉，在一回合内发动5次技能【愈勇】。',
						name: '永不服输',
						word: '贝',
						reward: {
							'0': ['reward1', 100],
						},
						need: 1,
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							if (event.num == 5) return true;
							return false;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLjiale1: {
						level: [5, 20, 50],
						over: true,
						info: '使用珈乐赢得###场胜利。',
						name: '皇家骑',
						word: '乐',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLjiale2: {
						level: [10, 40, 100],
						info: '使用珈乐，在对局中总计发动###次技能【代餐】。',
						name: '吃代餐',
						word: '乐',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLjiale3: {
						info: '使用珈乐，在一场对局中发动【岸潮】令其他角色摸牌数量达到20张。',
						name: '捏麻麻太潮啦',
						word: '乐',
						reward: {
							'0': ['reward1', 100],
						},
						need: 1,
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							if (event.num >= 20) return true;
							return false;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLjiaran1: {
						level: [5, 20, 50],
						over: true,
						info: '使用嘉然赢得###场胜利。',
						name: '嘉心糖',
						word: '然',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLjiaran2: {
						info: '使用嘉然，在对局中总计发动30次技能【然佑】。',
						name: '圣嘉然',
						need: 30,
						word: '然',
						reward: {
							'0': ['reward1', 50],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLjiaran3: {
						info: '使用嘉然，一场对局中发动30次技能【化魔】。',
						name: '小恶魔',
						word: '然',
						reward: {
							'0': ['reward1', 50],
						},
						need: 30,
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLnailin1: {
						level: [5, 20, 50],
						over: true,
						info: '使用乃琳赢得###场胜利。',
						name: '奶淇琳',
						word: '琳',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLnailin2: {
						level: [10, 40, 100],
						info: '使用乃琳，在对局中总计发动###次技能【胆大】。',
						name: '朝你大腿摸一把',
						word: '琳',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLnailin3: {
						info: '使用乃琳，在对局中全场角色均被你视为女性。',
						name: '乃All',
						word: '琳',
						reward: {
							'0': ['reward1', 50],
						},
						need: 1,
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							if (game.countPlayer(function (current) {
								return current.hasSex('female', game.me);
							}) == game.players.length) return true;
							return false;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLacao1: {
						level: [5, 20, 50],
						over: true,
						info: '使用阿草赢得###场胜利。',
						name: '草学长',
						word: '草',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLacao2: {
						level: [10, 40, 100],
						info: '使用阿草，在对局中总计发动###次技能【告罪】。',
						name: '滑跪',
						word: '草',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLacao3: {
						info: '使用阿草，成功达成使命技。',
						name: '985高材生',
						word: '草',
						reward: {
							'0': ['reward1', 50],
						},
						need: 1,
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLheicao1: {
						info: '使用黑草，在一场对局中使用8次【设备检修】。',
						name: '嗯造设备',
						word: '草',
						need: 1,
						skill: 'CLheicao1',
						reward: {
							'0': ['reward1', 25],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLjiaran4: {
						info: '使用嘉然，在一场对局中击杀向晚。',
						hide: true,
						name: '然攻不灭',
						word: '然',
						need: 1,
						skill: 'CLjiaran4',
						reward: {
							'0': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLjiaran5: {
						info: '使用嘉然，发动【然佑】将一张【毒】交给向晚。这是为了纪念在测试中充满戏剧性的一局游戏。',
						hide: true,
						name: '嘉晚饭的一切都很假',
						word: '然',
						need: 1,
						reward: {
							'0': ['reward2', 1],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLhuangjiaqi1:{
						info: '使用黄珈琪，在珈乐阵亡后获得游戏胜利。',
						name: '我推的孩子',
						word: '推',
						need: 1,
						over:true,
						reward: {
							'0': ['character', 'sansan'],
						},
						count: function (name) {
							
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var yes=false;
							for(var i=0;i<game.dead.length;i++) if(game.dead[i].name==='jiale') yes=true;
							if(!yes) return ;
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLxiangwan4:{
						info: '使用向晚，在装备【精英手柄】的情况下，连续三次发动效果。',
						hide: true,
						name: 'REAL GAMER!',
						word: '晚',
						need: 1,
						reward: {
							'0': ['character', 'mobile_xiangwan'],
						},
						check: function (event, name) {
							if (name.indexOf(game.me.name) == -1) return false;
							return true;
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							if (!lib.config[name]) lib.config[name] = {};
							var num = 0;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.need) return;
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.need) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},

					CLdingwanren1: {
						level: [5, 20, 50],
						over: true,
						info: '使用丁婉仁赢得###场胜利。',
						name: '晚比',
						word: '婉',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLbeijixing1: {
						level: [5, 20, 50],
						over: true,
						info: '使用贝极星赢得###场胜利。',
						name: '拉姐',
						word: '贝',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLhuangjiaqi2: {
						level: [5, 20, 50],
						over: true,
						info: '使用黄珈琪赢得###场胜利。',
						name: '乐乐',
						word: '珈',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLjiaxintang1: {
						level: [5, 20, 50],
						over: true,
						info: '使用嘉心棠赢得###场胜利。',
						name: '然比',
						word: '糖',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLlinnaiqi1: {
						level: [5, 20, 50],
						over: true,
						info: '使用林乃麒赢得###场胜利。',
						name: '乃宝',
						word: '奶',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLcaoxuezhang1: {
						level: [5, 20, 50],
						over: true,
						info: '使用草学长赢得###场胜利。',
						name: '大它',
						word: '它',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLbolilingran1: {
						level: [5, 20, 50],
						over: true,
						info: '使用博丽灵然赢得###场胜利。',
						name: '入宅不深啊',
						word: '然',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLsansan1: {
						level: [5, 20, 50],
						over: true,
						info: '使用叁叁赢得###场胜利。',
						name: '春春的桂物',
						word: '唐',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
					CLmobile_xiangwan1: {
						level: [5, 20, 50],
						over: true,
						info: '使用手杀向晚赢得###场胜利。',
						name: '-50宝珠',
						word: '晚',
						reward: {
							'0': ['reward1', 25],
							'1': ['reward1', 100],
							'2': ['reward2', 1],
						},
						count: function (name) {
							if (lib.config[name] && lib.config[name].finish) return;
							var level = 0, num = 0;
							if (lib.config[name] && lib.config[name].level) level = lib.config[name].level;
							if (lib.config[name] && lib.config[name].now) num = lib.config[name].now;
							if (num == this.level[level]) return;
							if (!lib.config[name]) lib.config[name] = {};
							num++;
							lib.config[name].now = num;
							game.saveConfig(name, lib.config[name]);
							if (num == this.level[level]) {
								game.saveConfig('challengefinish', lib.config.challengefinish ? lib.config.challengefinish + 1 : 1);
								game.challengeFinish(name, this);
							}
						},
					},
				},
			},

		},
		dynamicTranslate: {
			danda: function (player) {
				if (player.storage.danda1) return '出牌阶段限一次，你可以将一张基本牌当【推心置腹】使用（无距离限制）。';
				if (player.storage.danda2) return '出牌阶段限一次，你可以将一张基本牌当【顺手牵羊】使用（无距离限制）。获得牌时，你可以将其交给一名其他女性角色，然后对其造成1点自适应伤害。';
				if (player.storage.danda3) return '出牌阶段限一次，你可以将一张基本牌当【顺手牵羊】使用（无距离限制）。获得牌时，你可以弃置之，然后令一名女性角色回复1点极星体力。';
				return '出牌阶段限一次，你可以将一张基本牌当【顺手牵羊】使用（无距离限制）。';
			},
			guili: function (player) {
				if (player.storage.guili) return '出牌阶段限一次，你可以将一名其他角色的所有手牌置于牌堆顶，并令其摸等量的牌 ，然后其展示所有手牌，若此时其手牌：均为红色，你摸一张牌；均为黑色，你对其造成1点伤害。';
				else return '出牌阶段限一次，你可以将一名其他角色的所有手牌置于牌堆顶，然后令其摸等量的牌 。';
			},
		},
		translate: {

			beila: '贝拉',
			xiangwan: '向晚',
			jiale: '珈乐',
			jiaran: '嘉然',
			nailin: '乃琳',
			acao: '阿草',
			heicao: '黑草',

			yuyong: '愈勇',
			wuhun: '舞魂',
			wuhun2: '舞魂',
			yuemian: '月冕',
			yuemian2: '月冕',

			daican: '代餐',
			anchao: '岸潮',

			ranyou: '然佑',
			huamo: '化魔',
			shuangmian: '双面',
			shuangmian2: '双面',

			danda: '胆大',
			danda1: '胆大①',
			danda2: '胆大②',
			danda3: '胆大③',
			qingchun: '清纯',
			qingchun1: '清纯',
			qingchun2: '清纯',
			qingchun_male:'清纯',
			qingchun_female:'清纯',
			naiao: '乃傲',

			taiji: '太极',
			gaozui: '告罪',
			benghuai: '崩坏',
			baonue_hp: '体力',
			baonue_maxHp: '体力上限',
			dahuo: '答惑',

			neiping: '内评',
			neiping3: '内评',

			puge: '谱歌',
			puge2: '谱歌',
			puge3: '谱歌',
			yaoqiang: '要强',
			cainv: '才女',
			feichu: '废除',

			scaleph: '水母',
			jellyfish: 'ଲ',
			Shaixiu: '害羞小水母',
			Smingan: '敏感小水母',
			Skeai: '可爱小水母',
			Saojiao: '傲娇小水母',

			Shaixiu_info: '当一张以你为目标的非延时游戏牌的效果生效时，你可以重铸此【害羞小水母】并取消之。',
			Smingan_info: '出牌阶段，对攻击范围内的一名其他角色使用。其弃置手牌中所有基本牌（至少一张），否则受到2点伤害（每回合限使用1次）。',
			Skeai_info: '出牌阶段，对自己使用；或对一名濒死的角色使用。令其回复1点体力。若该角色仍受伤，令其摸一张牌。',
			Saojiao_info: '出牌阶段，对距离为1的一名角色使用。弃置其装备区或判定区内的所有牌。',


			yuyong_info: '当你受到一次伤害后，可以摸取数量等同于你本回合内受到伤害次数的牌。',
			wuhun_info: '出牌阶段限X次，你可以将一张非基本手牌当【舞斗】使用；你在斗舞过程中可以将一张红色牌当【杀】使用或打出。（X为你的已损失体力值+1）。',
			yuemian_info: '主公技。每轮限一次，其他魂势力角色于其出牌阶段，可以将一张非基本手牌交给你。',

			daican_info: '出牌阶段限一次，你可以指定一名本回合内未被此技能指定过的角色，令其摸两张牌，再弃置至少一张牌。若其弃置的牌点数之和不小于13，本回合内可再次使用本技能。',
			anchao_info: '限定技。出牌阶段，你可以对所有手牌数多于你的角色造成1点伤害，令所有手牌数少于你的角色将手牌补至与你相同。',

			ranyou_info: '一名其他角色受到伤害后，你可以交给其一张手牌，然后获得一个“圣”标记。',
			huamo_info: '每回合限一次。其他角色使用非转化的非延时牌在结算后进入弃牌堆时，你可以弃置一张花色与之相同的手牌，然后获得此牌，并获得一个“魔”标记。',
			shuangmian_info: '准备阶段和结束阶段，你可以弃置一个“圣”标记并摸一张牌；出牌阶段，当你使用一张基本牌或普通锦囊牌时，你可以弃置两个“魔”标记并额外指定一个可指定的目标。',

			danda_info: '出牌阶段限一次，你可以将一张基本牌当无距离限制的【顺手牵羊】使用。',
			qingchun_info: '锁定技，你视为双性。当你使用牌指定其他角色为唯一目标时，若此牌为：普通锦囊牌，将其视为女性；基本牌，将其视为男性。若其性别对你发生改变，你摸一张牌。',
			naiao_info: '准备阶段，你可以发起一次投票，令场上所有男性角色依次选择一项修改效果，你根据得票数最多的选择修改【胆大】。',

			taiji_info: '使命技。①你跳过所有延时效果的判定。②成功：回合开始时，若你判定区内牌的数量不少于四张，你可以移动这些延时牌，增加4点体力上限，回复4点体力，然后获得技能“崩坏”与“答惑”。③失败：在使命成功前，若你进入濒死状态，你失去1点体力上限并你将体力回复至1点，然后废除你的判定区。',
			gaozui_info: '锁定技，当你受到伤害、失去体力或失去体力上限后，你亮出牌堆顶的一张牌，若其可以置入你的判定区，将其置入你的判定区，若不能，你获得之。',
			benghuai_info: '锁定技，结束阶段，若你的体力不是全场最少的(或之一)，你须减1点体力或体力上限。',
			dahuo_info: '锁定技，判定阶段开始时，若你的判定区没有牌，你失去1点体力，若你的判定区有牌，你将一张判定牌移动到其他角色的判定区。',

			neiping_info: '每回合限一次，你可以将一张黑色牌当作【会者不难】使用。若因此使用【会者不难】后，你摸一张牌并将其视为【设备检修】直到其离开手牌区。',

			puge_info: '出牌阶段开始时，或当你受到一次伤害后，你可以废除一种花色，然后选择一张水母牌获得之。',
			yaoqiang_info: '出牌阶段限一次。你可以用一张花色被废除的手牌与一名其他角色拼点。若你赢，你选择一项：1.复原此花色 2.弃置手牌中所有花色与之相同的牌，然后选择等量的各不相同的水母牌（至多四张），获得之。',
			cainv_info: '锁定技，当你的拼点牌亮出后，其点数+X（X为废除的花色数）。',

			bolilingran: '博丽灵然',

			jiejie: '结界',
			JJfengmo: '封魔',
			JJsaiqian: '塞钱',
			JJerchong: '二重',
			JJfengyin: '封印',

			jiejie_info: '锁定技。你的回合开始时，你随机获得一个符卡技能。一名角色回合结束时，你移去所有“圣”标记并摸等量的牌。',
			JJfengmo_info: '出牌阶段限一次，你弃置一张装备牌，然后废除一名其他角色装备区的一个装备栏。',
			JJsaiqian_info: '出牌阶段限一次，你令其他角色交给你一张牌，否则其受到1点自适应伤害。',
			JJerchong_info: '每轮限一次，一名其他角色的判定阶段结束后，你可以与其交换摸牌阶段与出牌阶段。',
			JJfengyin_info: '锁定技，结束阶段，你从牌堆顶亮出三张牌，然后你依次视为使用X张【杀】（X为所亮出牌的花色数量）。',

			//整活
			mobile_xiangwan: '手杀向晚',
			zhaowan: '找晚',
			zhaowan_info: '出牌阶段限一次，你可以找一次小向晚，根据找到向晚的速度来获得对应评级。然后你按照评级依次获得水母牌：S级以上，获得三张水母牌；A级，获得两张水母牌；B级，获得一张水母牌；C级以下，你是猪猪吗这么慢omo。',
			maoyu: '猫语',
			maoyu2: '猫语',
			maoyu_info: '锁定技，弃牌阶段开始时，若你手牌中有水母牌，你的手牌上限-1。当有水母牌因弃置而移出游戏时，你可以选择一项：1.摸一张牌；2.卜算两张牌。',

			dingwanren: '丁婉仁',
			huangjiaqi: '黄珈琪',
			jiaxintang: '嘉心棠',
			beijixing: '贝极星',
			linnaiqi: '林乃麒',
			caoxuezhang: '草学长',

			zhuliu: '逐流',
			xueyan: '谑言',
			luanbei: '乱辈',

			zhengbei: '整备',
			zhengbei2: '整备',
			lijia: '理家',

			heimu: '黑目',
			xiangfu: '相赴',
			xiangfu2: '相赴',

			kangya: '抗压',
			tianyin: '天引',
			fabing: '发病',

			jiheng: '玑衡',
			ziwei: '紫微',

			hongru: '鸿儒',
			shuangbiao: '双标',

			zhuliu_info: '锁定技。你的出牌阶段内，所有角色的牌花色均视为水母。你的【杀】没有其他额外效果时，此【杀】获得“下雨”。',
			xueyan_info: '出牌阶段限一次，你可以与一名判定区没有【杀】的其他角色拼点：若你赢，你将你的拼点牌当延时【杀】置入其判定区；若你没赢，你令目标角色回复1点体力。',
			luanbei_info: '结束阶段，若本回合内至少有三种类别的水母花色牌被使用或亮出，你可以选择并获得一张水母牌。',

			zhengbei_info: '其他角色的出牌阶段，可以将一张装备牌置入你的装备区（不得替换原装备），然后摸一张牌。',
			lijia_info: '结束阶段，你可以指定一名角色：该角色下个回合的结束阶段，将手牌摸至或弃至与你装备区内牌的数量相同。',

			heimu_info: '每回合限一次。一名角色使用非延时牌指定你为唯一目标后，你可以选择一项执行：1.弃置所有手牌，然后摸取等量的牌 2.将一张手牌当【延时满足】置入该角色的判定区。',
			xiangfu_info: '当你一次性获得至少三张牌后，你可以令一名其他角色摸一张牌；其他角色一次性获得至少三张牌后，其可以令你摸一张牌。',

			kangya_info: '锁定技。未被横置的角色对你造成伤害时，须将武将牌横置，否则此伤害-1。',
			tianyin_info: '当你使用非延时牌指定一名未被横置的其他角色为唯一目标或为额外目标时，该角色选择一项：1.将武将牌横置；2.令你为此牌再选择一名目标（无视距离）。',
			fabing_info: '出牌阶段限一次，你可以对自己造成1点火焰伤害。',

			jiheng_info: '游戏开始时，你将“星盘”置于武将牌旁。准备阶段，你可以对“星盘”进行操作，然后令“星盘”对应的效果立即生效。',
			ziwei_info: '锁定技，当你未获得“星盘”效果时，你获得“紫微”效果。当你受到伤害时，你卜算X*2张牌，然后摸一张牌。（X为你本回合内受到伤害次数）',

			hongru_info: '锁定技，若你使用的上一张牌是基本牌或延时【杀】，你使用或延迟使用的下一张【杀】无视距离且不计入次数限制。',
			shuangbiao_info: '每回合限一次。一名角色的判定结果生效前，你可以令其再进行一次判定，然后你选择其中一张作为判定结果。',

			//星图及七星
			qixing: '七星',
			xingpan: '星盘',
			xingpan_dieafter: '星盘',
			Bziwei: '紫微',
			Bziwei_draw: '紫微',
			Btianshu: '天枢',
			Btianshu_c: '天枢',
			Btianxuan: '天璇',
			Btianxuan_c: '天璇',
			Btianji: '天玑',
			Btianji_c: '天玑',
			Btianquan: '天权',
			Btianquan_c: '天权',
			Byuheng: '玉衡',
			Byuheng_c: '玉衡',
			Bkaiyang: '开阳',
			Bkaiyang_c: '开阳',
			Byaoguang: '摇光',
			Byaoguang_c: '摇光',

			Bziwei_info: '你回复体力时均改为回复极星体力，当一名角色回复极星体力后，你摸一张牌。',
			Btianshu_info: '正位，出牌阶段，你可以多使用一张【杀】。',
			Btianshu_c_info: '逆位，出牌阶段，你不能使用【杀】。',
			Btianxuan_info: '正位，你的非延时锦囊不能被无懈。',
			Btianxuan_c_info: '逆位，你的锦囊牌均视为【闪】。',
			Btianji_info: '正位，摸牌阶段，你多摸一张牌。',
			Btianji_c_info: '逆位，摸牌阶段，你少摸一张牌。',
			Btianquan_info: '正位，结束阶段，若你本回合使用过锦囊，摸两张牌。',
			Btianquan_c_info: '逆位，结束阶段，若你本回合没有使用过锦囊，失去一点体力。',
			Byuheng_info: '正位，准备阶段，你可以弃置任意张牌并摸等量的牌。',
			Byuheng_c_info: '逆位，准备阶段，你须弃置所有牌并摸等量的牌。',
			Bkaiyang_info: '正位，结束阶段，若你本回合造成伤害，摸两张牌。',
			Bkaiyang_c_info: '逆位，结束阶段，若你本回合没有造成伤害，失去一点体力。',
			Byaoguang_info: '正位，造成伤害时，你可以失去1点体力，令此伤害+1。',
			Byaoguang_c_info: '逆位，造成伤害时，失去与此伤害相同的体力。',

			BJX_ziwei: '紫微',
			BJX_tianshu: '天枢',
			BJX_tianxuan: '天璇',
			BJX_tianji: '天玑',
			BJX_tianquan: '天权',
			BJX_yuheng: '玉衡',
			BJX_kaiyang: '开阳',
			BJX_yaoguang: '摇光',

			BJX_ziwei_info: '你回复体力时均改为回复极星体力，当一名角色回复极星体力后，你摸一张牌。',
			BJX_tianshu_info: '出牌阶段：正位，可以多使用一张【杀】；逆位，不能使用【杀】。',
			BJX_tianxuan_info: '正位，你的非延时锦囊不能被无懈；逆位，你的锦囊牌均视为【闪】。',
			BJX_tianji_info: '摸牌阶段：正位，多摸一张牌；逆位，少摸一张牌。',
			BJX_tianquan_info: '结束阶段，若你本回合：正位，使用过锦囊，摸两张牌；逆位，没有使用过锦囊，失去一点体力。',
			BJX_yuheng_info: '准备阶段：正位，你弃置任意张牌并摸等量的牌；逆位，你弃置所有牌并摸等量的牌。',
			BJX_kaiyang_info: '结束阶段，若你本回合：正位，造成伤害，摸两张牌；逆位，没有造成伤害，失去一点体力。',
			BJX_yaoguang_info: '造成伤害时：正位，你可以失去1点体力，令此伤害+1；逆位，失去与此伤害相同的体力。',

			//33可爱捏
			sansan: '叁叁',
			shensuan: '神算',
			shensuan2: '神算',
			guili: '桂离',
			zhiju: '智局',
			guili_gai: '桂离·改',

			shensuan_info: '锁定技，你的回合内一名角色摸牌前，你卜算X+1张牌（X为其本次摸牌的数量）；你受到一次伤害后，卜算三张牌。',
			guili_info: '出牌阶段限一次，你可以将一名其他角色的所有手牌置于牌堆顶，然后令其摸等量的牌 。',
			zhiju_info: '觉醒技，准备阶段，若你在本局游戏中进行过至少七次卜算，你可以回复1点体力，并选择一项：1.失去【桂离】并获得【代餐】；2.修改【桂离】。',
			guili_gai_info: '出牌阶段限一次，你可以将一名其他角色的所有手牌置于牌堆顶，并令其摸等量的牌 ，然后其展示所有手牌，若此时其手牌：均为红色，你摸一张牌；均为黑色，你对其造成1点伤害。',

			//群魔乱舞
			niuzhi: '牛芷',
			yingyingmin: '嬴莹姄',
			zhijiangemeng: '枝江噩梦',

			niupi: '牛批',
			niuduo: '牛堕',
			yinchuang: '引创',
			yinchuang2: '引创',
			kaichuang: '开创',
			zhongji: '终极',
			zhongji2: '终极',
			liudu: '流毒',

			changsheng: '常胜',
			choutai: '丑态',
			choutai2: '丑态',

			guishu: '诡术',
			qiufo: '求佛',

			niupi_info: '其他角色的结束阶段，若其于本回合内使用了至少三张牌且没有“牛”标记，你可以令其获得一个“牛”标记。',
			niuduo_info: '限定技，准备阶段，你可以增加X点体力上限并回复X点体力，获得技能【流毒】和【崩坏】；或减少X点体力上限，获得技能【开创】和【终极】。（X为场上“牛”标记数量）',
			liudu_info: '锁定技，当你受到伤害时，你摸一张牌，若伤害来源：有“牛”标记，此伤害+1；没有“牛”标记，此伤害-1且你将此牌视为【毒】直到其离开手牌区。',
			kaichuang_info: '每回合限一次，你对拥有“牛”标记的角色造成伤害时，你可以失去1点体力并移除目标角色的“牛”标记，然后令此伤害+X（X为目标体力值减去伤害值）；伤害结算后，该角色回复X点体力。',
			zhongji_info: '锁定技，你的手牌上限为X（X为场上“牛”标记数量且最大为3）。你的回合内，你造成不小于3点伤害或使用第三张牌时，摸一张牌。',
			//	yinchuang_info: '锁定技，你受到一次伤害后，须获得一个“牛”标记。场上拥有“牛”标记的角色受到的伤害+X（X为你的“牛”标记数量）。',
			//	zhongji_info: '锁定技，当你使用一张牌时，若此牌点数：是3的倍数，你获得一个“牛”标记；不是3的倍数，你摸一张牌。',
			//	liudu_info: '当一名其他角色于其出牌阶段使用了第二张牌后，你可以获得一个“牛”标记，然后令其于本回合内获得技能【终极】。',

			changsheng_info: '出牌阶段限一次，你可以与一名其他角色拼点，若你赢，你摸数量等同于拼点牌点数之差的牌。若你没赢，与你拼点的角色收回拼点牌。',
			choutai_info: '锁定技，当你摸牌时，若本次摸牌数：小于X，多摸一张牌；大于X，须在摸牌后将手牌弃置到X张（X为你的体力上限）。',

			guishu_info: '锁定技，出牌阶段开始时，你将一张诡牌洗入牌堆中。当一张诡牌被展示时，你可以回复1点体力或摸两张牌。',
			qiufo_info: '锁定技，你的回合结束时，若你本回合没有造成伤害，你须失去1点体力并对一名其他角色造成1点伤害。',

			Mchenshi: '尘世歌者',
			Myishi: '一世情缘',
			Mhuadeng: '华灯初上',

			Mchenshi_info: '当抽到此牌时展示，你受到2点雷电伤害。',
			Myishi_info: '当抽到此牌时展示，你获得“求佛”。',
			Mhuadeng_info: '当抽到此牌时展示，你摸三张牌，然后将武将牌翻面。',

			_Mchenshi: '尘世歌者',
			_Myishi: '一世情缘',
			_Mhuadeng: '华灯初上',

			zhijiang_feng: "风",
			zhijiang_hua: "花",
			zhijiang_xue: "雪",
			zhijiang_yue: "月",
			zhijiang_tedian: '特典',
			//成就 
		},
	};
});
